[Python-bugs-list] [ python-Bugs-468887 ] type(self) not preserved on some methods

noreply@sourceforge.net noreply@sourceforge.net
Sun, 07 Oct 2001 18:20:53 -0700


Bugs item #468887, was opened at 2001-10-07 18:20
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=468887&group_id=5470

Category: Type/class unification
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark J (average)
Assigned to: Guido van Rossum (gvanrossum)
Summary: type(self) not preserved on some methods

Initial Comment:
Python-2.2a4

For user-defined types derived from built-in types, it
appears that built-in methods which return copies are
not preserving the type of self.  

>>> class Test(list): pass
>>> t=Test()
>>> map(type, [t, t[:], t+t])
[<class '__main__.Test'>, <type 'list'>, <type 'list'>]
>>> t += t
>>> type(t)
<class '__main__.Test'>

Same with types int, dictionary, etc.

Thanks,

Mark




----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=468887&group_id=5470