4 ms·
significant whitespace Many years ago, this delayed me looking seriously into Python. But when its powerful data structures finally convinced me to start usin
by Luyt 16y ago
significant whitespace
Many years ago, this delayed me looking seriously into Python. But when its powerful data structures finally convinced me to start using it, I quickly became accustomed to significant whitespace: I always indented my code correctly anyway, whatever language I'd use. So it was just a case of dropping the { and }.
After a few hours I was accustomed to it.
The funny thing is, I still program a lot in C++ and PHP (and Java sometimes). When I write these languages, I fall back on using { and } like I did before, without even noticing it.
Getting proficient in a new language doesn't make you forget your old languages.
- RodgerTheGreat 16y agoI appreciate where you're coming from, but of the three gripes I mentioned whitespace is the least of my concerns. The syntax of Python bothers me much less than the design philosophy.
- rbanffy 16y agoAny specifics? I may be using Python for so long that I got used to its warts. Some outside perspective could be useful.
- drblast 16y agoI can't answer for the parent poster, but one thing specifically irked me about Python and that was the variable scoping rules and the lack of forced declaration. The result was that any misspelling of variables could result in extremely difficult to find bugs. This was a final straw that pushed me over the "I don't really care for the syntax of this language much" cliff. Not a showstopper, but combined with a number of other small complaints, Python "rubbed me the wrong way" too. Yeah, significant whitespace alone isn't a problem. Lack of variable definition by itself isn't a big deal. Explicit "Self" as a parameter is kind of annoying but makes sense. The lame anonymous functions that don't have the full power of the language are ugly. Taken together those are enough to turn me off to the language. BUT, Python has a few killer features like great libraries, flexible built in data structures, and an excellent foreign function interface. If I needed a scripting language for a native-code app it would be one of the top choices. By the way, my experience with Python is a few years old, I don't know if anything's changed with the new version. Edit to add: Other dynamic languages have various solutions to the variable declaration problem, usually involving a parser or compiler warning when you use an unbound variable. Python's syntax would have to change to make that possible, I think.
- rbanffy 16y ago> any misspelling of variables could result in extremely difficult to find bugs Weird. Unless all you do is to attribute them values, Python will complain when you try to use a name that's not in the current namespace. > The lame anonymous functions I too complained a lot about them. In the end, all I had to do was to declare the function in the closest scope and pass it to whatever would use the anon function. No big deal. > warning when you use an unbound variable Python throws an error when you try to use an unbound name. Python is not BASIC.
- MichaelSalib 16y agoThe lame anonymous functions that don't have the full power of the language are ugly. Tis true, python lambdas are lame, but in practice, their use has been mostly superceded by list (and now set and dictionary) comprehensions. Edit to add: Other dynamic languages have various solutions to the variable declaration problem, usually involving a parser or compiler warning when you use an unbound variable. Python's syntax would have to change to make that possible, I think. I don't understand. If you mistype a name, you'll get an error when you run the code.
- dagw 16y agoIf you mistype a name, you'll get an error when you run the code. Depends on the context of the typo. I've had errors along the lines of bar=False ... bat=True ... if bar: print "Hi" And wondered why "Hi" was never printed. Of course the problem is hardly unique to Python.