[New-bugs-announce] [issue7390] inconsistent type return
Sérgio Surkamp
report at bugs.python.org
Tue Nov 24 13:37:27 CET 2009
New submission from Sérgio Surkamp <sergio at gruposinternet.com.br>:
The type function returns inconsistent value depending on class hierarchy.
>>> class X:
... pass
...
>>> x = X()
>>> type(x)
<type 'instance'>
>>> class Y(object):
... pass
...
>>> x = Y()
>>> type(x)
<class '__main__.Y'>
>>>
>>> class Z(X):
... pass
...
>>> x = Z()
>>> type(x)
<type 'instance'>
>>> class K(Y):
... pass
...
>>> x = K()
>>> type(x)
<class '__main__.K'>
All should reply 'instance'. As long as I have read on documentation the
only way to change the type function return is by writing a
__metaclass__ (PEP3115).
----------
components: Interpreter Core
messages: 95670
nosy: surkamp
severity: normal
status: open
title: inconsistent type return
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7390>
_______________________________________
More information about the New-bugs-announce
mailing list