[New-bugs-announce] [issue14671] isinstance(obj, object) returns True for _old style_ classes
Q
report at bugs.python.org
Thu Apr 26 04:53:36 CEST 2012
New submission from Q <abonent at gmail.com>:
$python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
>>> class Old: pass
>>> class New(object): pass
>>> o = Old()
>>> n = New()
>>> isinstance(o, object)
True
This is it, basically. Is it a bug or a feature?
More tests :
>>> isinstance(o, Old)
True
>>> isinstance(o, New)
False
>>> isinstance(n, Old)
False
>>> isinstance(o, int)
False
Please note that some unimportant output was deleted from above.
PS. If this is a feature, how do I detect an old-style class then ?
----------
components: Interpreter Core
messages: 159351
nosy: thread13
priority: normal
severity: normal
status: open
title: isinstance(obj, object) returns True for _old style_ classes
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14671>
_______________________________________
More information about the New-bugs-announce
mailing list