This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients
Date 2007-05-19.16:25:11
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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'>
History
Date User Action Args
2007-08-23 14:53:55adminlinkissue1721812 messages
2007-08-23 14:53:55admincreate