New submission from Sérgio Surkamp <ser...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue7390>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to