Ian Bicking wrote:
> class Quitter(object):
>      def __init__(self, name):
>          self.name = name
>      def __repr__(self):
>          return 'Use %s() to exit' % self.name
>      def __call__(self):
>          raise SystemExit()
> quit = Quitter('quit')
> exit = Quitter('exit')
> 
> This is not very magical, but I think is more helpful than the current 
> behavior.  It does not satisfy the "just do what I said" argument for 
> not requiring the call (quit() not quit), but eh -- I guess it seemed 
> like everything that didn't require a call had some scary corner case 
> where the interpreter would abruptly exit.
> 

It also nicely aligns with the way that license() and help() already work at 
the interactive prompt.

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to