static variables

Antoon Pardon antoon.pardon at rece.vub.ac.be
Wed Dec 2 03:21:49 EST 2015


Op 02-12-15 om 02:24 schreef Steven D'Aprano:
> Python has three not-entirely-awful solutions to the problem of static
> locals, but no really great or obvious one.

I think python is unsuited for an obvious solution for static locals.
Because you need to initialise your static variable somewhere. If you
initialise whithin the body of your function, you will have a statement
that is essentialy a declaration instead of an executable statement.
Which goes totally against the dynamic nature op python.

-- 
Antoon




More information about the Python-list mailing list