operator overloading + - / * = etc...
Bruno Desthuilliers
onurb at xiludom.gro
Mon Oct 9 11:27:29 EDT 2006
Steven D'Aprano wrote:
> On Sat, 07 Oct 2006 17:21:55 -0500, Tim Chase wrote:
>
>>>> With the caveat of the "=" mentioned in the subject-line (being
>>>> different from "==")...I haven't found any way to override
>>>> assignment in the general case.
>>> Why would you want to do that?
>> For the same reason one would use property() to create
>> getter/setter functions for a particular variable--to intercept
>> attempts to set a variable.
>
(snip)
> Suppose we bind the name "x" to the object 1, and then rebind the name "x"
> to the object []. Which object's hypothetical __assign__ method should get
> called?
The current namespace object, of course.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list