maximum recursion depth?

Sebastian 'lunar' Wiesner basti.wiesner at gmx.net
Wed May 28 13:54:23 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[ Marc 'BlackJack' Rintsch <bj_666 at gmx.net> ]

> On Wed, 28 May 2008 02:28:54 -0700, bearophileHUGS wrote:
> 
>> Dennis Lee Bieber, the ghost:
>>> I'd have to wonder why so many recursive calls?
>> 
>> Why not?
> 
> Because of the recursion limit of course.  And function call overhead in
> Python is quite high compared to an iterative approach.
And limiting the recursion depth is quite reasonable: The python interpreter
doesn't perform tail call optimisation, each level of recursion depth eats
a bit more memory.  Without a recursion limit a python process might hit
the memory restrictions of the OS kernel, which would cause the OS kernel
to just silently kill the interpreter process.  Now image this happening
inside a mission critical server process ;)


- -- 
Freedom is always the freedom of dissenters.
                                      (Rosa Luxemburg)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkg9nFQACgkQn3IEGILecb5ziQCfe7BcH/7hzMH/6QmGcFy0qQGd
cGoAn0dM0fkErYTs4zlY6kDYdOBEN8+D
=cWxH
-----END PGP SIGNATURE-----



More information about the Python-list mailing list