On 7/15/2012 4:32 AM, Steven D'Aprano wrote:
On Sun, 15 Jul 2012 10:49:48 +1000, Chris Angelico wrote:

On Sun, Jul 15, 2012 at 9:29 AM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
Not necessarily *compile* time, but the distinction is between when the
function is defined (which may at compile time, or it may be at run
time) versus when the function is called.

I'd treat the def/lambda statement as "compile time" and the () operator
as "run time".

But function definitions occur at run time, not compile time -- they are
executable statements, not instructions to the compiler to define a
function.

The () operator is 'call time'. The main points are
a) the execution of def statements and lambda expressions and the execution of calls happen at different run times.
b) default arg objects are calculated at def/lambda time.
c) names in def bodies and lambda expressions are resolved at call time.
and
d) people more often forget c) when thinking about lambda expressions that for def statements.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to