reassign to builtin possible !?

Bernhard Merkle bernhard.merkle at googlemail.com
Thu Jan 3 08:42:54 EST 2008


On Jan 3, 2:07 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> This hal always been possible. But it's not reassigning, it's shadowing -
> which is a totally different beast. Shadowing builtins is bad style, but
> lokal to your context. Which can get nasty of course, if you do the above
> on e.g. module level.
>
> But you can't alter the values for True/False globally with this.

Are you sure ? what about the following example ?
Is this also shadowing ?

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import __builtin__
>>> __builtin__.True = False
>>> __builtin__.True
False
>>> True
False

Berni



More information about the Python-list mailing list