exiting Python

B

beliavsky

I think exiting Python with 'Ctrl-Z plus Return' is awkward. Why not
something simpler like ':q[uit]'. Since ':q' is currently invalid
syntax, I don't think using it to quit Python would break anything.
 
P

Peter Maas

I think exiting Python with 'Ctrl-Z plus Return' is awkward. Why not
something simpler like ':q[uit]'. Since ':q' is currently invalid
syntax, I don't think using it to quit Python would break anything.

class SimpleExit:
def __repr__(self):
print "Python: Sssssssee you!"
import sys
sys.exit(0)

q = SimpleExit()

Include this in your PYTHONSTARTUP and you're done. Just type

whenever you want to exit and avoid conflicting use of q in
interactive sessions. :)

Mit freundlichen Gruessen,

Peter Maas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top