This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: types.InstanceType only for old style class only in 2.7
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Nan Wu, berker.peksag, docs@python, python-dev
Priority: normal Keywords: patch

Created on 2016-04-13 15:29 by Nan Wu, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
doc_InstanceType_is_for_old_style_cls.patch Nan Wu, 2016-04-13 15:29
Messages (3)
msg263338 - (view) Author: Nan Wu (Nan Wu) * Date: 2016-04-13 15:29
>>> import types
>>> a = 1
>>> isinstance(a, types.InstanceType)
>>> class A:
...     pass
>>> a = A()
>>> isinstance(a, types.InstanceType)
>>> class A(object):
...     pass
>>> a = A()
>>> isinstance(a, types.InstanceType)

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.
msg263403 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-04-14 12:50
New changeset b684298671f9 by Berker Peksag in branch '2.7':
Issue #26747: Document that InstanceTypes only works for old-style classes
msg263404 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-04-14 12:51
Date User Action Args
2022-04-11 14:58:29adminsetgithub: 70934
2016-04-14 12:51:40berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg263404

resolution: fixed
stage: patch review -> resolved
2016-04-14 12:50:42python-devsetnosy: + python-dev
messages: + msg263403
2016-04-13 16:07:41SilentGhostsetassignee: docs@python

nosy: + docs@python
components: + Documentation
stage: patch review
2016-04-13 15:29:00Nan Wucreate