[Tutor] (no subject)

Advertising Department advertising at robbstucky.net
Fri Jun 11 23:12:27 CEST 2010


#!/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?



More information about the Tutor mailing list