using "private" parameters as static storage?
Ben Finney
bignose+hates-spam at benfinney.id.au
Thu Nov 13 19:09:29 EST 2008
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.
--
\ “I hope that after I die, people will say of me: ‘That guy sure |
`\ owed me a lot of money’.” —Jack Handey |
_o__) |
Ben Finney
More information about the Python-list
mailing list