Re:First Impressions of Python from a Java Developer
by pyre on Monday November 08, 2010 @03:52PM
(#1883965)
I think that it's much more readable due to familiarity more than anything else. The C syntax for the ternary operator was the one thing that it took me the longest time to get used to when learning to program. I usually just ignored it because it was too hard to remember what it did. That said, I can easily read it now, but I still feel that the Python syntax is more understandable.
Which is more readable:
> condition ? value1 : value2
or
> value1 if condition else value2
Maybe the latter is just more readable to me because I'm used to reading Perl all day long that looks like:
> die unless condition;
> return true if condition;
> return false
> if condition1 && condition2 && condition3;
Which is more readable:
or Maybe the latter is just more readable to me because I'm used to reading Perl all day long that looks like: That said, I'm also used to reading: and I still find the Python ternary operator more readable: