operator overloading + - / * = etc...
onurb at xiludom.gro
Mon Oct 9 17:27:29 CEST 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.
> 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
The current namespace object, of course.
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