Python complaints

James Logajan JamesL at Lugoj.Com
Sat Dec 4 00:36:50 EST 1999


Michael Hudson wrote:
> 
> "Tim Peters" <tim_one at email.msn.com> writes:
> > At the risk of obfuscating it, here's another way to write the same thing:
> >
> >     x = x+1
> 
> Rather more efficient too...

Nice and efficient so long as all you do is increment yourself along the X
axis. But suppose you are using Python to maintain a count of the population
of the planet Earth and want to use a sensible variable name (for porting
purposes of course, in case you need to us e the same code on the planet
Mars and want to remember which variable had the population count in it so
you can change it to the right name). You'd have code that would look like:

populationOfthePlanetEarth = populationOfThePlanetEarth + 1

versus:

populationOfThePlanetEarth++

And if you weren't careful, you might make a hidden typo (like I did in the
first example), thereby causing a cessation of population growth which would
seriously impact economic growth and cause untold hardship. Therefore in the
interest of the world economy it is essential that the next version of
Python support the increment operator.

I rest my case. Or at least my head.




More information about the Python-list mailing list