Python's "only one way to do it" philosophy isn't good?

Terry Reedy tjreedy at
Wed Jun 13 22:49:04 CEST 2007

"Steve Howell" <showell30 at> wrote in message 
news:725498.90657.qm at
| You would just change the language definition to say
| that once you enter f(), any call to f() from within
| f() behaves as if the recursively called f() still
| points to the originally bound version of f.

I am pretty sure such a context-dependent rule cannot be written as a 
context-free grammar rule.  In any case, the function object does not exist 
when code is being compiled to a code object.  So this requires 
implementation-dependent post-patching of the code object.  R. 
Hetchinger(sp?) posted a Cookbook recipe for doing this for CPython. 
Anyone wanting the speedup (with CPython) can use it.


More information about the Python-list mailing list