overloading operators
QdlatY
qdlaty at ikom.pl
Thu Jan 24 07:21:35 EST 2002
"Alex Martelli" <aleax at aleax.it> wrote in
news:a2on71$j5s$1 at serv1.iunet.it:
> "QdlatY" <qdlaty at ikom.pl> wrote in message
> news:Xns91A0418F84Aqdlatywielundhsorg at 153.19.253.204...
>> Hello
>>
>> Is it possible to overload an operator in python (for objects) ?
>
> Yes, see http://www.python.org/doc/current/ref/specialnames.html .
>
> Basically, you can define a method named __add__ to 'overload' operator
> +, one named __mul__ to overload operator *, and so on.
>
Thanks :-)
Btw. Is it possible to create new operator ? f.e. "++" ?
--
QdlatY
mailto: qdlaty at ikom.pl
"Jezeli wydaje Ci sie ze wiesz wszystko - masz racje - wydaje Ci sie..."
More information about the Python-list
mailing list