
June 2, 2000
11:21 p.m.
Would it be too much trouble to prevent replacing double-underscore attributes like __name__ and __file__?
This can be handy sometimes.
I'll accept a "consenting adults" argument -- it's just that somehow this makes me uneasy:
OK - accept it :-) Just dont do it if it makes you uneasy.
>>> import foo >>> foo.__name__ 'bar' >>> foo.__file__ 'bar.py' >>> foo <module 'bar' from 'bar.py'>
That is no worse than, say:
a=1 globals()['a']=2 a 2
So you could make the same argument that globals() should be read-only, to force you to do the "normal" thing. To me, this is one of Python's big features. I dont want it holding my hand so tightly it cuts circulation :-) Mark.