vjovanov at stevens-tech.edu
Wed Jun 5 16:51:59 CEST 2002
> If you are going to always store the equation, never the value, what
> happens when the user does
> c.y = 37
> c.y = 'y+1'
that is very simple, look at my response to Tim Peters
and the method __setattr__
str(val) takes care of c.y=37
I suggets that you play with my Foo class to see how all that works.
> Then you're left with detecting stuff like
> c.x = "y"
> c.y = "x+1"
cycle staff can be taken care with a counter, I don't see a problem with
> Well, good luck with your project -- and don't spring any more
> requirements on us, it's getting harder each time to solve your problem.
Sorry, but it is not that my problem is hard. It is that the concept of
to reference instance variables always through self. is making it hard and
inconvenient which was my point in my original post.
My opinion is that those points explained in FAQ are irrelevant. The only
one relevant is .....
"When classes were added to Python, this was (again) the simplest way of
implementing methods without too many changes to the interpreter. "
This sentence says it all, everything after that is said in FAQ is of less
it looks like "well, we did it in the simplest way, but, you know, this way
better for you, let us show you how ..."
The consequence is that the simplest solution is not always the best one.
More information about the Python-list