Optional parameter object re-used when instantiating multiple objects
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Nov 20 23:15:00 EST 2008
On Thu, 20 Nov 2008 04:42:24 -0800, Aaron Brady wrote:
> On Nov 19, 7:58 pm, alex23 <wuwe... at gmail.com> wrote:
>> On Nov 20, 10:14 am, Aaron Brady <castiro... at gmail.com> wrote:
>>
>> > If you had a menu in a browser interface that had the items, say,
>> > 'Stop' and 'Reload', what would you expect to happen if you clicked
>> > on them?
>>
>> If you had a keyword called 'def', which defined functions, would you
>> expect it to define said functions when it executed, or on each
>> function call?
>
> At first, I would expect it to define them at compile-time. Then, when
> I learned there was no such thing,
Of course there is compile-time. When did you think the .pyc files got
created?
The same thing happens in the interactive interpreter: the function is
compiled to byte-code, and then the compiled function is executed by the
VM.
--
Steven
More information about the Python-list
mailing list