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.

classification
Title: Could method "isinstance" take a list as parameter?
Type: enhancement Stage: resolved
Components: Library (Lib) Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Chen.ZHANG, ezio.melotti, iritkatriel, jwilk, mark.dickinson
Priority: normal Keywords:

Created on 2014-01-28 09:27 by Chen.ZHANG, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg209519 - (view) Author: Chen ZHANG (Chen.ZHANG) Date: 2014-01-28 09:27
Since the usage of isinstance could be "isinstance(1, (int, float))", I'm wondering why it doesn't accept "[int, float]", if I do so, it would raise TypeError saying "arg 2 must be a type or tuple of types". What's the difference in effect between a tuple and a list here? (I know a tuple is immutable, but I think it doesn't matter when passing some other types of non-string iterables(yielding strings), am I right?
msg209521 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2014-01-28 09:35
See related discussion on python-ideas here:

https://mail.python.org/pipermail/python-ideas/2011-July/010610.html
msg382546 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-12-04 23:27
Interesting discussion, and the reason seems to be here:
https://mail.python.org/pipermail/python-ideas/2011-July/010642.html

Lists need to be checked for cycles, tuples don't.
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64614
2020-12-04 23:27:51iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg382546

resolution: rejected
stage: resolved
2014-02-15 15:49:04ezio.melottisetnosy: + ezio.melotti
2014-01-30 13:24:08jwilksetnosy: + jwilk
2014-01-28 09:35:21mark.dickinsonsetnosy: + mark.dickinson
messages: + msg209521
2014-01-28 09:27:54Chen.ZHANGcreate