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 | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4