How can I create customized classes that have similar properties as 'str'?

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Sat Nov 24 12:00:25 CET 2007


Licheng Fang wrote:
> I mean, all the class instances that equal to each other should be
> reduced into only one instance, which means for instances of this
> class there's no difference between a is b and a==b.

If you only want that if "a == b" is True also "a is b" is True,
overload the is_ attribute of your class. Personally, I don't see
any advantage in this.

Regards,


Björn

-- 
BOFH excuse #352:

The cables are not the same length.




More information about the Python-list mailing list