List operator overloading snag

Paul Prescod paul at prescod.net
Sun Apr 25 13:36:26 EDT 2004


Steven Brent wrote:

>...
> The problem is that I can't seem to get my wrapped lists to use the
> overloaded versions of the operators without calling the customize
> instance method directly, as shown below:
> 
>>>>import setwrapper; from setwrapper import *
> 
> 
>>>>S1 = Set(['s','p','a','m'])
>>>>S2 = Set(['s','c','a','t'])
> 
> 
>>>>print S1 or S2

Try this:

 >>> print S1 | S2

  Paul Prescod






More information about the Python-list mailing list