[Python-Dev] a quit that actually quits (original) (raw)
Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Tue Dec 27 15:41:11 CET 2005
- Previous message: [Python-Dev] a quit that actually quits
- Next message: [Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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!
- Previous message: [Python-Dev] a quit that actually quits
- Next message: [Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]