using "private" parameters as static storage?

Steven D'Aprano steve at
Fri Nov 14 04:38:26 CET 2008

On Thu, 13 Nov 2008 13:35:21 -0500, Steve Holden wrote:

> Joe Strout wrote:
>> One thing I miss as I move from REALbasic to Python is the ability to
>> have static storage within a method -- i.e. storage that is persistent
>> between calls, but not visible outside the method.  I frequently use
>> this for such things as caching, or for keeping track of how many
>> objects a factory function has created, and so on.
> This is a pretty bizarre requirement, IMHO. The normal place to keep
> such information is either class variables or instance variables.

*jaw drops*

You know, there were one or two programs written before the invention of 
object-oriented programming techniques. Some of them required persistent 
storage between function calls, and global variables have obvious 
disadvantages. That's why the C language uses static variables.


More information about the Python-list mailing list