A Bug By Any Other Name ...

Stefan Behnel stefan_ml at behnel.de
Tue Jul 7 13:48:32 EDT 2009


Lawrence D'Oliveiro wrote:
> I wonder how many people have been tripped up by the fact that
> 
>     ++n
> 
> and
> 
>     --n
> 
> fail silently for numeric-valued n.

I doubt that there are many. Plus, you misspelled them from the more obvious

	n++

and

	n--

which *do* fail with a SyntaxError. I think I faintly remember trying those
in my early Python days and immediately went for "+=" when I saw them fail
(as I had expected).

Stefan



More information about the Python-list mailing list