[Python-au] New Python Class Features

Brian White bwhite@steptwo.com.au
Fri, 17 Jan 2003 15:07:09 +1100


At 15:04 17/01/2003, Andrew Bennetts wrote:
>I'd recommend only using property for computed attributes (i.e. ones that
>need a function call to calculate their value).  Most of the time you don't
>need them.
>
> > What I am trying to determine if their is a short way as this is going to
> > take ages when writing an object that has 20 properties
>
>Indeed :)
>
>Just use the simplest thing that works -- accessing the attributes directly.
>Is there any particular reason why you wanted to use properties?


In one sense it depends on how much of a purist you are!

Using Get/Set methods means that at any time you can
change the underlying storage or trigger events off the
Get and Set

Maybe it depends how far up the hierachy your class is...

Regs

Brian White

-------------------------
Brian White
Step Two Designs Pty Ltd
Knowledge Management Consultancy, SGML & XML
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: bwhite@steptwo.com.au

Content Management Requirements Toolkit
112 CMS requirements, ready to cut-and-paste