Python Success stories

Paul Hankin paul.hankin at gmail.com
Tue Apr 22 14:09:55 EDT 2008


On Apr 22, 5:50 pm, Jérémy Wagner <jeremy.wag... at laposte.net> wrote:
> Sure. Python is more readable than Perl, though I have found Python
> to have a weird behavior regarding this little issue :
>
> How can you explain that Python doesn't support the ++ opeator,
> whereas at the same time it does support the += operator ???
>
> No python developer I know has been able to answer that.

Because ++ is of limited use and has poor readability?

'x++' vs 'x += 1' saves 3 characters and is less readable.

'my_long_variable += expression' vs 'my_long_variable =
my_long_variable + expression' saves a lot of characters and is more
readable, because it avoids the duplication of the variable name. When
my_long_variable is a more complex term (perhaps
my_long_variable[some_long_expression]) it's even better.

Plus you get the useful update-in-place behaviour when the left-hand-
side of the += expression is a list.

--
Paul Hankin



More information about the Python-list mailing list