>Assuming that A is a new-style class then if they have to be
>exactly the same type compare the types

Ah-ha! I didn't know that.

>if the 'other' value can be a subclass of self:
>
>   def join(self, other):
>      if not isinstance(other, type(self)):
>           raise whatever

Simple and neat!

>If A is an old-style class then you would have to compare
>the __class__ attribute: self.__class__ != other.__class__

That answered my question perfectly. I'll read up on the new style
classes and pick whichever of your solutions fits best.

Many thanks,
Andy.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to