[Python-Dev] 2.5 and beyond
ark at acm.org
Sat Jul 1 01:27:06 CEST 2006
> That sounds like a bug, not a feature. It's frequently useful to have
> forward references in function bodies to names that are not yet globally
> bound, e.g. for classes, or mutually-recursive functions.
The trouble is that you don't necessarily know in what scope they will be
defined, so I think that forcing you to be explicit about it is useful. Can
you show me an example of where you think it isn't?
Incidentally, I think that lexical scoping would also deal with the problem
that people often encounter in which they have to write things like "lambda
x=x:" where one would think "lambda x:" would suffice.
More information about the Python-Dev