Message32078
Sorry, this is just the way Python works. Given that the __and__ operation has no way of knowing the signature of your subclass contructor, it will produce a new set from your two foo inputs. This design prevades the language (for example list and int have similar behaviors). Recommend closing this as not-a-bug:
>>> class foo(list):
def __init__(self, iter):
print 'foo.__init__'
list.__init__(self, iter)
>>> x = foo([1,2])
foo.__init__
>>> y = foo([2,3])
foo.__init__
>>> x + y
[1, 2, 2, 3]
>>> type(_)
<type 'list'>
>>>
>>> class foo(int):
pass
>>> foo(1) + foo(2)
3
>>> type(_)
<type 'int'> |
|
Date |
User |
Action |
Args |
2007-08-23 14:53:55 | admin | link | issue1721812 messages |
2007-08-23 14:53:55 | admin | create | |
|