Getters and setters in python, common practise

Dang Griffith noemail at noemail4u.com
Thu Apr 15 08:00:19 EDT 2004


On Thu, 15 Apr 2004 14:07:25 +0300, Petter Holmström <peholmst at abo.fi>
wrote:

>Peter Hansen wrote:
>>> Having a Delphi/Object Pascal-background, I'm very used to using 
>>> getters and setters when designing my classes. What is the common 
>>> practise in the Python world? Should one use them or not?
>> 
>> Max described the common practice (don't use them until you actually
>> need them) but forgot to mention that in recent versions of Python
>> you can use "properties", in pretty much the same manner as Delphi
>> uses them.
>
>I have not found any documentation on this topic. Could you please point 
>me to some?

Food for a day:
    http://www.python.org/2.2/descrintro.html#property
Teach you to fish:
    http://www.python.org/search/
    --dang



More information about the Python-list mailing list