Overloaded Operators allowed???

Bjorn Pettersen bjorn at roguewave.com
Wed Jul 5 17:38:35 EDT 2000


Jeff wrote:
> 
> Can you overload operators as you can in other languages?  For example, can
> I make "&" give the address of something as in C++?  Or can I only overload
> things like the cmp operator?  i.e. I want to say &string and get the
> address of string.

Since "&string" is illegal syntactically in Python it wouldn't make
sense to let you overload on it.  It would be like saying "I want to
overload @ in C++ so I can use it to append lists, like list1 @
list2..."

Besides, you really don't want the address of the string (trust me
<wink>).

-- bjorn




More information about the Python-list mailing list