What python idioms for private, protected and public?
Fredrik Lundh
fredrik at pythonware.com
Thu Sep 29 10:47:15 EDT 2005
Michael Schneider wrote:
> 1) mark an object as dirty in a setter (anytime the object is changed,
> the dirty flag is set without requiring a user to set the dirty flag
properties.
> 2) enforce value constraints (even if just during debugging)
properties. (when you no longer need to enforce things, switch back
to a plain attribute).
> 3) lazy init, don't bring the data in until needed
properties.
> 4) adding debug info
properties.
> 5) .... more here????
properties.
> It would be easy for me to say "Add public and private to python so I
> can code the way that I am used to".
huh? what do "private" and "public" have to do with what you're describing?
> What are some python alternatives to achieve the design intents specified
> above above?
properties.
http://users.rcn.com/python/download/Descriptor.htm#properties
</F>
More information about the Python-list
mailing list