[Edu-sig] Design patterns

Arthur ajsiegel at optonline.net
Sun Aug 21 16:33:45 CEST 2005



> -----Original Message-----
> From: edu-sig-bounces at python.org [mailto:edu-sig-bounces at python.org] On
> Behalf Of Arthur
> 
> What beyond sugar for leaving off a "()" when trying to retrieve a value
> from a method are we accomplishing by using properties? I have tended to
> look at properties mostly  an accommodation to those coming from other
> languages which have something similar, but never as something that was
> core
> to Python or a Pythonic approach to things.  Am I missing something
> fundamental?

The searching I do on this point only confirms to me that my own confusion
is well shared - perhaps indicating this to be an area not totally OT for
this forum.

Ray Hettinger's "How-To Guide for Descriptors"

http://users.rcn.com/python/download/Descriptor.htm

covers properties, but the use case given is extremely unsatisfying -
essentially offering a situation where a fundamental design change has been
made to a program in mid-stream, and since properties were used in the
initial design, the change can be made with little refactoring. 

Somehow I don't expect a programming language to accommodate the possibility
of a midstream change in a programs design/intentions of the kind cited
here.  New design, and the expectation would be to need to recode to the new
design.  All within bounds, of course. OOP, I think, does try to address
this issue to a reasonable degree. 

But the properties use case in this article is, to my intuition, a stretch
beyond those reasonable bounds.

I can't believe that a language or coding style intended to accommodate the
range of possibilities for the kind of fundamental midstream redesign
referenced in this use case could lead anywhere else but to some kind of
madness.   

The fact is that I do use properties to a limited degree in PyGeo -  the
actual implementation of properties being trivial enough.  Much less trivial
is the why and when.  The brain dead use of properties in PyGeo being
definitely on my list for refactoring.  Just not sure whether I should be
consistent in avoiding them, or consistently using them, or when is which
and which is when.

Art






More information about the Edu-sig mailing list