[Ironpython-users] Gradually executing a python script

Jeff Hardy jdhardy at gmail.com
Tue Jul 24 20:23:41 CEST 2012


On Tue, Jul 24, 2012 at 11:22 AM, Jeff Hardy <jdhardy at gmail.com> wrote:
> On Tue, Jul 24, 2012 at 5:54 AM, Jesper Taxbøl <jesper at taxboel.dk> wrote:
>> Agreed that could work :), but would still hang if a kid writes an infinite
>> loop without actions inside.
>>
>> I am really into making something robust for kids to play with.
>>
>
> sys.settrace is your friend here. Basically, if a robot tries to
> execute too many lines between yields (i.e. per turn), remove it from
> the list of valid robots and show an error.

Forgot to add:

http://www.doughellmann.com/PyMOTW/sys/tracing.html

- Jeff


More information about the Ironpython-users mailing list