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

Created on 2014-01-28 09:27 by Chen.ZHANG, last changed 2014-02-15 15:49 by ezio.melotti.

Messages (2)
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:
Date User Action Args
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