Sandboxing [Was Re: killing thread ?]
Jp Calderone
exarkun at intarweb.us
Fri Jan 24 22:38:36 EST 2003
More information about the Python-list mailing list
Fri Jan 24 22:38:36 EST 2003
- Previous message (by thread): Sandboxing [Was Re: killing thread ?]
- Next message (by thread): killing thread ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jan 24, 2003 at 10:11:08PM -0500, Terry Reedy wrote: > > "Paul Rubin" <phr-n2003b at NOSPAMnightsong.com> wrote in message > news:7xn0lq3v0b.fsf at ruckus.brouhaha.com... > > Recursion depth is already limited. > > I was thinking of something more limited, like > sys.setrecursionlimit(10), instead of the current default of 1000 (on > my box). > import time start = time.time() try: (lambda x: x(x))(lambda x: x(x)) except RuntimeError: print 'Took %0.2f seconds' % (time.time() - start) import sys sys.setrecursionlimit(10) start = time.time() try: (lambda x: x(x))(lambda x: x(x)) except RuntimeError: print 'Took %0.2f seconds' % (time.time() - start) On my machine, at least, the interval is so short that it is more or less random which of the two blocks takes longer to execute, with times varying from a hundredth of a second to four times that. On hardware that hasn't been obsolete since the last millenium, it's probably even less noticable. And who knows, your user might want to execute code for processing a reasonably sized tree. Are you really going to be so mean, and force them to write an iterative version of the algorithm? :) Jp -- "There is no reason for any individual to have a computer in their home." -- Ken Olson, President of DEC, World Future Society Convention, 1977 -- up 40 days, 7:49, 7 users, load average: 0.55, 0.53, 0.50 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-list/attachments/20030124/5b1fc152/attachment.sig>
- Previous message (by thread): Sandboxing [Was Re: killing thread ?]
- Next message (by thread): killing thread ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list