New submission from Nan Wu:

>>> import types
>>> a = 1
>>> isinstance(a, types.InstanceType)
False
>>> class A:
...     pass
... 
>>> a = A()
>>> isinstance(a, types.InstanceType)
True
>>> class A(object):
...     pass
... 
>>> a = A()
>>> isinstance(a, types.InstanceType)
False

Looks like isinstance(instance, types.InstanceType) only return True for 
user-defined old-style class instance. If it's the case, I feel doc should 
clarify that like what types.ClassType did. If no, someone please close this 
request. Thanks.

----------
files: doc_InstanceType_is_for_old_style_cls.patch
keywords: patch
messages: 263338
nosy: Nan Wu
priority: normal
severity: normal
status: open
title: types.InstanceType only for old style class only in 2.7
type: enhancement
versions: Python 2.7
Added file: 
http://bugs.python.org/file42456/doc_InstanceType_is_for_old_style_cls.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26747>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to