Really stupid question regarding PEP 252 and type/class unification
bokr at accessone.com
Thu Aug 23 23:58:19 CEST 2001
On 23 Aug 2001 21:00:15 GMT, Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote:
>Thu, 23 Aug 2001 19:30:44 GMT, Bengt Richter <bokr at accessone.com> pisze:
>> lhs = rhs
>> Is it cast in concrete *for always and forever* that the
>> old binding of the lhs will *always* be discarded in favor of a new
>> binding to the rhs without regard to the previous binding?
>I think yes. The old binding doesn't need to exist at all.
In which case there would be no object to check for a preemption method,
so that wouldn't hurt anything.
>> IOW, one could conceive of a check for an attribute of the old
>> binding's object which if present would mean that the old object
>> gets to handle the reference to the new rhs and leave the old
>> binding alone.
>IMHO it would be confusing to have an extremely rare case where the
>= operator means something different. I would not use this operator
>for this case. It always meant rebinding of a name. The old binding
>is irrelevant - the object doesn't need to exist at all.
I guess I have to agree that one meaning for '=' is best.
Perhaps ':=' could be used to access a lhs object's assignment/rebinding
method, if such a thing were useful (which I think it might be. A concise
way of talking to a particular kind of object method is usually nice).
Something like '+=' with a different meaning.
More information about the Python-list