[Python-Dev] Protecting __name__ &c.
Ka-Ping Yee
pingster@ilm.com
Fri, 2 Jun 2000 16:10:01 -0700 (PDT)
Would it be too much trouble to prevent replacing
double-underscore attributes like __name__ and __file__?
I'll accept a "consenting adults" argument -- it's just
that somehow this makes me uneasy:
Python 1.5.2 (#54, Jul 14 1999, 12:50:51) [C] on irix6
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import foo
>>> foo.__name__
'bar'
>>> foo.__file__
'bar.py'
>>> foo
<module 'bar' from 'bar.py'>
Of course, there is no 'bar.py'. 'foo.py' just contains
__file__ = 'bar.py'
__name__ = 'bar'
(If you say i deserved to be punished for such heresy, fine...)
-- ?!ng