operator over loading

Peter Maas peter.maas at mplusr.de
Mon May 24 03:53:34 EDT 2004


Anand K Rayudu wrote:
> I have defined q python class and want to know if i can over load '=' 
> operator.

You mean assignment? You can't overload that because ist is not
function like (doesn't return a value).

If you mean comparison (==) then you want the __eq__() method.
Details see Python Manual 3.3.1 Basic customization.

If you seek for a copy constructor, have a look at copy.deepcopy
in Python Manual 3.18.

Mit freundlichen Gruessen,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------



More information about the Python-list mailing list