using "private" parameters as static storage?

Steve Holden steve at holdenweb.com
Thu Nov 13 19:15:37 EST 2008


Ben Finney wrote:
> Joe Strout <joe at strout.net> writes:
> 
>> 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
> 
> This is precisely what classes are for: allowing functionality and
> state to exist in a single object.
> 
>> but not visible outside the method.
> 
> Bind the state to a name with a single leading underscore (‘_foo’),
> which is the convention for “not part of the public interface”.
> Don't look for hard access restrictions, though, because they don't
> really exist in Python.
> 
Neither do typed variables, but that's not going to stop Joe ;-)

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list