for animal in ['dog', 'cat', 'bear']:
print animal
strikes me as intuitive and obvious, both absolutely and also relative to the equivalents in other languages.ADD 1 TO COBOL GIVING COBOL
is also readable, and yet (thankfully!) we've mostly abandoned COBOL.
And no, I'm not saying Python is bad, or like COBOL - just that readability and quality of a language are not necessarily related.
Python is readable because its syntax is very close to many people's version of pseudocode. This is why non-Python programmers find it easy to read.
Or at least that is what Python developers seem to believe
(Yes, I just spent the last 10 minutes reading the COBOL pages on Wikipedia and Wikibooks.)
ADD 1 TO X GIVING Y is COBOL's way of saying y=x+1 ADD 1 TO COBOL GIVING COBOL is COBOL=COBOL+1. Or COBOL++ :)
I'd agree that programming languages do have various levels of "readability", and that Python is better than quite a few...
However I think the poster has a point.
Someone familiar to programming concepts and new to Python could probably read that...but so could they read the equivalent statement in most languages.
Someone completely new, and reading only that statement?
I'm not convinced....
It seems obvious to you because you know it already.
As a newbie, I could see that as assigning an entire list to animal and then printing it...or even other things. I wouldn't be sure what the : was about
Additionally I think a similar for loop in any language will be basically just as readable to a complete newbie...in fact some may find a c-style for loop more readable.
For example, do you really think a newbie will understand this:
def __gen(exp):
for x in exp:
yield x**2
g = __gen(iter(range(10)))
print g.next()
Sure, it's pretty easy to understand once explained ...but so are most languages. It's obviously more readable than a Perl one-liner, and Python has properties that cause it to generally be more readable than many other languages....but I think the point about programming languages overall being "not so readable" stands.This makes sense though, as generally what people seem to mean by "readable" is "looks like English/forms a narrative"...and those often don't fit with what a computer program is (though sometimes they do).
That said, I really like the ideas this language is offering and I'm definitely interested in giving it at try.