operator overloading + - / * = etc...

Tim Chase python.list at tim.thechases.com
Sat Oct 7 17:48:49 EDT 2006


>> Can these operators be overloaded?
> 
> Yes.

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.  There might be some oddball way 
to do it via property() but AFAIK, this only applies to 
properties of objects, not top-level names/variables.  I'd love 
to know if there's some workaround for this though...

-tkc






More information about the Python-list mailing list