Raymond Hettinger wrote:
The question for the group is what to put on the XXX line.
1. Limit it to type(self). This approach claims the least knowledge
about other types and uses their __rand__ methods().
2. Use type(self), int, and long. This approach says that we know that
ints and longs can be reasonably converted to an int; however, it means
that any int/long subtype cannot use __rand__ to override the mixin's
__and__.
3. Emulate the PEP as closely as possible and accomodate subclassing
without changing behaviors. This approach is a bit complex:
knowntypes = (set(type(self).__mro__)
& set(type(other.__mro__))
- set(type(Integral.__mro__))
| set([int, long]))
if isinstance(other, tuple(knowntypes)):
4. As 2, but skip int/long subclasses:
if type(other) in (int, long) or isinstance(other, type(self)):
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com