static variables

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


Op 02-12-15 om 02:24 schreef Steven D'Aprano:
> Heh, I agree, and as I suggested, it might be good to have an actual
> mechanism for static locals. But using a class is no better: your "static
> storage" is exposed as an instance attribute, and even if you flag it
> private, *somebody* is going to mess with it.

Why don't you invoke the consenting adults now? People have come here
arguing for all kind of extra features, which would somehow defend
against messing with certain variable or attributes the author wants
protected. The general respons has always been, that we are consenting
adults here.

Static variables, are just a feature to protect what is essentially
a global variable against messing from somewhere else. So why is
this feature worthy of discussion and others are not?

-- 
Antoon.




More information about the Python-list mailing list