Comment Re:Why Python? (Score 2) 65
I used to think like Fahrbot-bot: Enforced whitespace is lame, and I'd like the creative freedom to just bang out one line of Perl when necessary. I now love programming in Python. (And felt this way after a week.) After using Emacs to edit lisp for six years, I've become accustomed to "magically" indenting everything to The Correct Place. The language doesn't require it, but the editor makes it trivial, and it's a huge win for code readability. The parens (and braces in other languages) can fade in importance, and become implied when reading a standard code formatting convention.
I tend not to notice the braces/parens in most languages, and rather depend on the notational convention of an indentation style. When code fits the convention, it's easy to read. Python merely enforces a convention which I would already want to use in nearly every case. Yes, I still wish it were easy to (sometimes) write one long line of something like I could in Perl or lisp, but since I rarely ever want to do that even in those languages, I'm willing to live with that. I wouldn't even call it a pain point, except for the fact that it makes it harder to do things like write toy implementations of a function, which I think I've wanted to do twice in three months.
One thing I love about Python, and which Perl doesn't do quite as prettily, is the list comprehension idiom. I find Python's syntactic sugar much easier to read, and it is the idiomatic way of doing a __lot__ of things.
#Perl:
@foo = map{ $_['a'] } @bar
#Python:
foo = [ b.a for b in bar ]
I used to think like Fahrbot-bot: Enforced whitespace is lame, and I'd like the creative freedom to just bang out one line of Perl when necessary. I now love programming in Python. (And felt this way after a week.) After using Emacs to edit lisp for six years, I've become accustomed to "magically" indenting everything to The Correct Place. The language doesn't require it, but the editor makes it trivial, and it's a huge win for code readability. The parens (and braces in other languages) can fade in importance, and become implied when reading a standard code formatting convention.
I tend not to notice the braces/parens in most languages, and rather depend on the notational convention of an indentation style. When code fits the convention, it's easy to read. Python merely enforces a convention which I would already want to use in nearly every case. Yes, I still wish it were easy to (sometimes) write one long line of something like I could in Perl or lisp, but since I rarely ever want to do that even in those languages, I'm willing to live with that. I wouldn't even call it a pain point, except for the fact that it makes it harder to do things like write toy implementations of a function, which I think I've wanted to do twice in three months.
The one thing I miss from Perl is the degree to which regular expressions are embedded in the language, and the ease with which one can use them. It's a little harder with Python, which I find frustrating at times.
One thing I love about Python, and which Perl doesn't do quite as prettily, is the list comprehension idiom. I find Python's syntactic sugar much easier to read, and it is the idiomatic way of doing a __lot__ of things.
#Perl:
@foo = map{ $_['a'] } @bar
#Python:
foo = [ b.a for b in bar ]
If you have been holding off on playing with Python because you love Perl, great. It's still a great language to work with, and the whitespace is not as bad to deal with as you might imagine. My friends use vim with it; I prefer Komodo. There are several other good editors as well.