Accessors in Python (getters and setters)
Bruno Desthuilliers
onurb at xiludom.gro
Mon Jul 17 09:58:15 EDT 2006
Bruno Desthuilliers wrote:
> mystilleef wrote:
(snip)
>>Here are the lessons I've learned (the hard way).
>>
>>1) Make all attributes of a class private or protected.
>
>
> Unless they are obviously part of the implementation
s/implementation/interface/, of course.
> (ie: when you would
> definitively had written getters/setters in Java), in which case make
> them public (and name them with the same care you would have for Java
> getters/setters). You can change the implementation later.
>
(snip)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list