Something is rotten in Denmark...
harrismh777
harrismh777 at charter.net
Tue May 31 20:09:38 EDT 2011
Terry Reedy wrote:
> This is early-binding versus late-binding. Python is a late-binding
> language.
ok ...
> Are you asking about changing all function compilation or only when
> functions are defined with lambda expressions?
At least lambda expressions, but (see below) any other built-in
where 'early-binding' makes sense for intuitive results or
performance--- possibly, not commenting.
The latter *would* make
> there be a 'suble nuance' that Python now lacks and does not need.
How so, and why not?
>> Has anyone suggested this?
> Of course, more than once, in multiple variations. All have so far been
> rejected, more than once. The most sensible ideas are for earlier
> binding of builtins to make Python run faster.
At the moment I'm only speaking about my OP and that particular list
comprehension... the thing that happened (at least for me) is that the
intuitive sense that each 'i' somehow becomes a part of the anonymous
function (I know, not so) is built-in. There is little to nothing
indicating in the docs that this is not so. Again, what we have here is
the 'i' being saved in a cell and looked up at call time (an
implementation detail, 'late-binding') that is critical for the
user-coder to understand. This *may* be true for other built-ins also,
I'm not commenting on that, but it seems to me that if lambda is going
to remain in the language at all that 'early-binding' in the lambda
specific case would make sense; at least make the lambda more useful
generally.
... just saying,
kind regards,
m harris
More information about the Python-list
mailing list