By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,814 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,814 IT Pros & Developers. It's quick & easy.

trigger exception in generator

P: n/a
I would like to trigger an
exception in a generator
upon return from "yield"
e.g.

def mySimulationTask():
while 1:
try:
# drive forward one simulation step
yield
# do some stuff
except HitWall:
# handle this disaster ;-)

How can I possibly do this?
Maybe by hacking some internal
generator variables? ;-)

Thanks,
Dominic

h i l l b r _at_ rhrk.uni-kl.de
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.