Linked by Thom Holwerda on Thu 9th Oct 2008 21:04 UTC, submitted by ganges master
General Development Python 2.6 has been released on October 1st. The major theme of this release is preparing the migration path to Python 3.0, a major redesign of the language. Whenever possible, Python 2.6 incorporates new features and syntax from 3.0 while remaining compatible with existing code by not removing older features or syntax. See the what's new docs for more details.
Thread beginning with comment 333063
To read all comments associated with this story, please click here.
Yeah, greate
by StychoKiller on Fri 10th Oct 2008 01:13 UTC
StychoKiller
Member since:
2005-09-20

My biggest peeve with python is the use of spaces to delimit blocks of statements. Does somebody have something against punctuation or what?

RE: Yeah, greate
by Clinton on Fri 10th Oct 2008 01:37 in reply to "Yeah, greate"
Clinton 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.

Reply Parent Bookmark Score: 2

RE[2]: Yeah, greate
by RandomGuy on Fri 10th Oct 2008 02:14 in reply to "RE: Yeah, greate"
RandomGuy Member since:
2006-07-30

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.

Reply Parent Bookmark Score: 3

RE[2]: Yeah, greate
by unavowed on Fri 10th Oct 2008 08:59 in reply to "RE: Yeah, greate"
unavowed Member since:
2006-03-23

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

Reply Parent Bookmark Score: 2

RE: Yeah, greate
by jwwf on Fri 10th Oct 2008 02:31 in reply to "Yeah, greate"
jwwf Member since:
2006-01-19

My biggest peeve with python is the use of spaces to delimit blocks of statements. Does somebody have something against punctuation or what?


I've programmed a decent amount of python and I still agree. I do appreciate that it forces sane indentation and so helps readability, but the problem is that you get a source of bugs that is just about invisible. By missing an indent (space), you can end up with an if statement where the last statement you believe to be in scope is actually outside, and thus executed regardless of the if condition. This does not actually happen often. But when it does, it's a bitch to find.

My point? Syntax elements should be visible. Other than that, love python.

Reply Parent Bookmark Score: 3

RE[2]: Yeah, greate
by Kaali on Fri 10th Oct 2008 05:20 in reply to "RE: Yeah, greate"
Kaali Member since:
2005-12-22

Try: python -tt file.py

And enable visible tabs in your editor to detect incompatibilities in the source.

Reply Parent Bookmark Score: 1

RE: Yeah, greate
by moxfyre on Fri 10th Oct 2008 03:57 in reply to "Yeah, greate"
moxfyre Member since:
2007-10-18

My biggest peeve with python is the use of spaces to delimit blocks of statements. Does somebody have something against punctuation or what?

Well, this is everybody's big pet peeve with Python. The first time I thought about switching from Perl to Python, I saw the whitespace thing and decided to ignore it for the next 3 years. Boy, big mistake. Now that I use Python for practically everything and love it to death, I don't notice the whitespace issues one bit.

I sometimes think Guido (Python's creator) takes a perverse delight in turning away all of us shallow-minded programmers. He thinks to himself, "Oh gosh, there goes another fool passing up the greatest programming language ever, with no idea of what he/she is missing." Well, I'm proud to have become a true believer ;)

Reply Parent Bookmark Score: 2

RE[2]: Yeah, greate
by DoctorPepper on Fri 10th Oct 2008 16:41 in reply to "RE: Yeah, greate"
DoctorPepper Member since:
2005-07-12

I totally agree with you. I used Perl for about seven years, pretty heavily, before getting into Python.

I tried to learn Python a couple of times, but like others have said, the whitespace thing through me off totally. In mid-2005, I took a contract with IBM, and the group I worked with was heavily into Python, so I bought "Learning Python" and the rest is history. Like parent said, I do not even notice the whitespace thing any longer, and find the readability of Python to be head and shoulders above Perl (and most other languages as well).

Advice to those who still scoff at Python because of enforced whitespace rules: Just try it. Grab a copy of "A Byte of Python" or perhaps "Dive into Python" and just do it, you really won't be sorry.

Reply Parent Bookmark Score: 2

RE[2]: Yeah, greate
by alopecoid on Sat 11th Oct 2008 05:05 in reply to "RE: Yeah, greate"
alopecoid Member since:
2005-07-07

...the greatest programming language ever...


I don't know man. I mean, I think Python's string formatting features are pretty bad. Look at the way Groovy handles strings and interpolation... so much more elegant.

In fact, look at the way Groovy does closures. It's actually unbelievable how much you can accomplish in Groovy in just a few lines of code... and it is readable too.

Now, I'm not saying Groovy is the best programming language ever, but I'm just making a point.

Reply Parent Bookmark Score: 1

RE: Yeah, greate
by Glynser on Fri 10th Oct 2008 07:16 in reply to "Yeah, greate"
Glynser Member since:
2007-11-29

I liked that in the beginning, actually, since I'm formatting and indenting my code anyway, and I liked it to be forced to do that.

But now, I also see the disadvantages: Whenever you copy & paste code, or you move some code block to somewhere else, it's just not as convenient, because you always have to look that you're doing it correctly, even if you're just testing something quickly.
And also, it's a problem when you want to comment out an if- or while-line so that the condition is gone and the code is definitely executed. Because if you do that, you have to de-indent the code block, and things might get very messy that way.

So those are the drawbacks for me, but of course it's also got some nice advantages.

Reply Parent Bookmark Score: 1

RE[2]: Yeah, greate
by Clinton on Fri 10th Oct 2008 07:49 in reply to "RE: Yeah, greate"
Clinton Member since:
2005-07-05

That is true to some degree. You usually notice that problem the most when you cut and paste code from one editor to the other. Editors with good Python support usually fix any tab width inconsistencies or tabs vs. spaces for you though.

Reply Parent Bookmark Score: 2

RE[2]: Yeah, greate
by helduel on Fri 10th Oct 2008 10:13 in reply to "RE: Yeah, greate"
helduel Member since:
2006-07-17

And also, it's a problem when you want to comment out an if- or while-line so that the condition is gone and the code is definitely executed. Because if you do that, you have to de-indent the code block, and things might get very messy that way.


No, just replace the condition to True and you're done.

Reply Parent Bookmark Score: 1

RE: Yeah, greate
by CrLf on Fri 10th Oct 2008 18:51 in reply to "Yeah, greate"
CrLf Member since:
2006-01-03

That seems to be everybody's pet peeve... everybody that hasn't programmed more than an hello world in Python, that is...

I've been there, so I'm speaking from experience. But once you start using Python instead of just reading about it, you realise that the whitespace rules are mostly invisible... I don't remember the last time I had some problem related to whitespace indentation. Actually, I don't remember _ever_ having such a problem...

But you end up noticing something... in other languages. I now find myself looking at C, java, etc. and thinking that they look messy (the same thing I always thought about perl). The absense of most delimiters in Python makes code look clean and concise (and easier to read).

Reply Parent Bookmark Score: 4