Automatic Generation of Python Class Files

Sunburned Surveyor sunburned.surveyor at gmail.com
Mon Oct 22 16:47:19 EDT 2007


On Oct 22, 1:23 pm, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> wrote:
> Steven Bethard a écrit :
> (snip)
>
> > In Python, you can use property() to make method calls look like
> > attribute access.  This could be necessary if you have an existing API
> > that used public attributes, but changes to your code require those
> > attributes to do additional calculations now.
>
> > But if you're creating a class for the first time, it should *never* use
> > property().  There's no need to retrofit anything.
>
> May I kindly disagree here ?-)
>
> Computed attributes are IMHO not only a life-saver when it comes to
> refactoring. There are cases where you *really* have - by 'design' I'd
> say - the semantic of a property, but know from the start you'll need
> computation (for whatever reason). Then what would be the rationale for
> using explicit getters/setters ?

Bruno,

Thanks for the detailed response. I need some time to digest what you
wrote. I will read this thread again and think carefully about what
you have saaid.

Scott Huey




More information about the Python-list mailing list