A Bug By Any Other Name ...

John Machin sjmachin at lexicon.net
Mon Jul 6 05:15:57 EDT 2009


On Jul 6, 12:32 pm, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> I wonder how many people have been tripped up by the fact that
>
>     ++n
>
> and
>
>     --n
>
> fail silently for numeric-valued n.

What fail? In Python, ++n and --n are fatuous expressions which
SUCCEED silently except for rare circiumstances e.g. --n will cause an
overflow exception on older CPython versions if isinstance(n, int) and
n == -sys.maxint - 1.




More information about the Python-list mailing list