[Tutor] (no subject)

2010-06-12 Thread Advertising Department

#!/Library/Frameworks/Python.framework/Versions/Current/bin/pythonw
"""still thinking in imperative"
"""

## obviously this is a bad construct.
## Can someone suggest a pythonesque way of doing this?


def getid():
response  = raw_input('prompt')
if response not in [ "", "y", "Y", "yes"] :
getid() # ouch
print "continue working"
# do more stuff
# do more stuff


getid()
dosomething()
getid()
dosomethingelse()


## obviously this is a bad construct.
## Can someone give me a pythonesque way of doing this?

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Better construct?

2010-06-14 Thread Advertising Department

Many thanks to all,

 repeat WHILE
is exactly what I needed.

I got BASIC stuck in my head. GOTO line# YUCK!


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor