27 Dec
2005
27 Dec
'05
8:41 a.m.
Fredrik Lundh wrote:
Reinhold Birkenfeld wrote:
What is wrong with something like this:
class Quitter: ... def __repr__(self): raise SystemExit ... exit = quit = Quitter()
vars() # oops!
You're right.
class Quitter: ... def __repr__(self): ... n = sys._getframe(1).f_code.co_names ... if n == ("exit",) or n == ("quit",): ... raise SystemExit
better? ;) Reinhold -- Mail address is perfectly valid!