properties setting each other
Maric Michaud
maric at aristote.info
Wed Sep 3 19:20:42 EDT 2008
Le Wednesday 03 September 2008 19:38:13 Bruno Desthuilliers, vous avez écrit :
> FWIW, if there's no computation on getting or setting value, you can
> make it a plain attribute.
Yes, this is the problem with these tiny examples, we don't know at which
point we must simplify them...
>
> But while it's quite clear that in this example use case it would be
> better to have only one property (weither square or value, depending on
> which is the most often use), things are not always that simple in real
> world code, and - as you mentionned - there may be times where you have
> interdependant properties and really want to avoid recomputing the same
> thing over and over. Now there's no one size fits all solution here -
> it's an optimization problem, and as such depends on real use cases.
Yes, my advice was exactly in that sense, it's an optimization problem,
duplicating such a data is a caching mechanism, and should be done knowingly,
in acceptance of all the complication it comes with.
--
_____________
Maric Michaud
More information about the Python-list
mailing list