To view parent comment, click here.
To read all comments associated with this story, please click here.
Seconded. Plus, there's a tool for those who want to program in python and still use curly brackets, IIRC.
The main difficulties caused by the significant indentation thing are:
a) Immediate yuck-reaction from former C programmers and those scarred by non-free-form FORTRAN.
b) Copying and pasting from forums gets harder. Whether or not this is bad is up to debate.
c) Mixing of tabs and spaces, especially in projects with more than one developer. If you can't get a bunch of people to follow the same coding style OR use a tool that changes the code accordingly, Python is probably the least of your problems, as in case b).
I've only used Python recently because it's just so much easier to remember/relearn than e.g. C++, especially if you just program in your spare time, for fun.
Except that if you want to keep your code width limited to, say, 80 columns, then in many cases you are forced to use backslashes at the end of a line to inform python that you intend to continue it in the next. I personally prefer braces or "end" keywords over having to do this manual dance, which sometimes makes me feel I'm writing for the C preprocessor.
Example:
$ cd /usr/share/blender/scripts && grep '\\$' *.py | wc -l
938
Edited 2008-10-10 09:02 UTC
Limiting code to 80 columns in this day and age is just ridiculous. There's nobody out there still programming at the console (an 80x25 console at least), and everybody else just uses more than 80 columns with no problems.
You may say long lines make code more difficult to read, but if you limit yourself to lines with at most 80 characters (excluding leading whitespace), you won't that that big of a need to break statements into multiple lines.
But forgetting that, most statements that can become longish can also be broken in multiple lines without backslashes (argument lists, conditional statements, ...). Every statement that requires something more can have that something more on another line without using backslashes.
Actually right now I can't see anything that can't be broken, other than strings... (eg: print "some" \ "string")







Member since:
2005-07-05
I thought that would bug me when I first started using Python back in the 1.x days, and it did. However, it really stops being an issue after just a short while.
While I'm a die-hard fan of parenthesis and curly braces, I think Python's syntax forces good code formatting and makes your code very easy to read. Also, when a problem comes my way, the first language I reach for to solve it is Python, so I think the Python team must be doing something right; at least from my point of view.