Nested scopes: design or implementation?

Terry Reedy tejarex at yahoo.com
Thu Mar 7 09:20:59 CET 2002


"logistix" <logstx at bellatlantic.net> wrote in message
news:Ntwh8.2920$J3.429 at nwrddc01.gnilink.net...
> Okay, now I'm confused.
>
> I was perfectly happy with Teddy Reedy's explaination that def is an
> expression and not a declaration.

What I said is that it is an *executable statement* rather than a
declaration.

> But if I'm following you, the embedded attribute function isn't
being
> recompiled to bytecode each time function() is called.

For efficiency, the body is compiled once.  However, this is not part
of the language definition (neither is the existence of byte code).

>  If the code object  is only getting created once,
> then why are the defaults getting  recalculated?

Defaults, I presume, are part of the function object which is created
with each invocation.

Terry J. Reedy







More information about the Python-list mailing list