Static variables [was Re: syntax difference]

Gregory Ewing gregory.ewing at 1
Sun Jun 24 14:58:58 EDT 2018


  To: Bart
From: Gregory Ewing <greg.ewing at canterbury.ac.nz>

Bart wrote:
> Wow. (Just think of all the times you write a function containing a neat
> bunch of local functions, every time it's called it has to create a new
> function instances for each of those functions, even if they are not used.)

Fortunately, function objects are small and cheap, essentially just a couple of
 object references. The overhead of creating one is probably about the same as
creating an empty list. If your function is complicated enough to benefit from
local functions, the cost is going to be swamped by the rest of the work being
done.

--
Greg

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)



More information about the Python-list mailing list