On Jan 3, 2008 8:05 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > >> 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 ? > > > >>>> import __builtin__ > >>>> __builtin__.True = False > >>>> __builtin__.True > > False > > It doesn't seem to screw things up globally > > >>> import __builtin__ > >>> t = __builtin__.True > >>> __builtin__.True = False > >>> __builtin__.False = t > >>> True > False > >>> False > True > >>> 1 == 1 > True > >>> import os > >>> os.path.isdir('.') > True > >>> #if they were globally redefined, this would be False > >>> #you'd have to actually reference __builtin__.True > > My thought would be if you do something as daft as > redefining/shadowing True and False, you get the headaches that > ensue. Fortunately, since Python is explicit, you can trace back > through the code and see where the inanity occurred. > Additionally, any scoping rules mean that programmer stupidity > can't leak too badly outside the scope of the block containing > the stupidity. > > It's the old "DIHWIDT! WDDT!" ("Doctor, it hurts when I do > this!", "well don't do that!") syndrome. >
In Py3k this will be a syntax error, like assigning to None is now. Possibly also in 2.6. -- http://mail.python.org/mailman/listinfo/python-list