autoincrementing

Lulu of the Lotus-Eaters mertz at gnosis.cx
Tue Feb 25 12:27:03 EST 2003


Alex Martelli <aleax at aleax.it> wrote previously:
|In Python, all binding and rebinding of names is in statements, never in
|expressions; and numbers are immutable -- so if x refers for example to
|the number 3, there is no way to make x refer to the number 4 except by
|rebinding name x to a different object (you cannot ALTER a number).

Not ALL rebinding of names is in statements, e.g.

    >>> x = 3
    >>> somevar = globals().__setitem__('x',4)
    >>> x
    4

Of course, I don't recommend trying this sort of abomination at home.
:-)

Yours, Lulu...

--
mertz@  | The specter of free information is haunting the `Net!  All the
gnosis  | powers of IP- and crypto-tyranny have entered into an unholy
.cx     | alliance...ideas have nothing to lose but their chains.  Unite
        | against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------






More information about the Python-list mailing list