What python idioms for private, protected and public?
Michael Schneider
michaelschneider at fuse.net
Thu Sep 29 20:24:13 EDT 2005
Frederik,
Thank you very much for the info on properties, that is very useful.
Sorry about the public typo, that should have been protected. I should
not post before coffee hits :-)
Happy coding,
Mike
Fredrik Lundh wrote:
> 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