[Tutor] question about function inside of function

Kent Johnson kent37 at tds.net
Mon Jan 11 03:29:10 CET 2010


On Sat, Jan 9, 2010 at 8:03 AM, spir <denis.spir at free.fr> wrote:

> Do you realize the inner func will be redefined before each call? Meaning in your case n calls x n outer loops x n inner loops.
>   def f() ...
> is actually a kind of masked assignment
>   f = function()...

That's true, but it is pretty inexpensive. The heavy lifting is at
compile time when a code object is created. Wrapping this as a
function is fast.

Kent


More information about the Tutor mailing list