Optional parameter object re-used when instantiating multiple objects

Aaron Brady castironpi at gmail.com
Thu Nov 20 19:07:31 EST 2008


On Nov 20, 5:54 pm, alex23 <wuwe... at gmail.com> wrote:
> On Nov 20, 10:42 pm, Aaron Brady <castiro... at gmail.com> wrote:
>
> > At first, I would expect it to define them at compile-time.  Then,
> > when I learned there was no such thing, I would expect it to define
> > them at execute-time.  What does that have to do with evaluating a
> > default argument?
>
> It has -everything- to do with it when we're talking about the
> defining of functions, and certainly a lot more relevance than straw
> man arguments on the behaviour of browser buttons.
>
> You said that you "would expect it to define them at execute-time". So
> is that when the interpreter first hits the def or when the
> interpreter hits every single function call? Because I personally
> consider it to clearly occur at the point of definition and not at the
> point of calling.

Why, I would expect the interpreter to define the functions when it
first hits the def, that is, at the point of definition.



More information about the Python-list mailing list