[Python-ideas] Allow isinstance second argument to be a set of types
Steven D'Aprano
steve at pearwood.info
Mon Jul 4 02:48:13 CEST 2011
Michael Foord wrote:
> Hello all,
>
> Occasionally I build up tuples of types for passing as the second argument
> to isinstance. I've noticed on occasions having duplicates, for example the
> following code is Python 2 & 3 compatible but results in a duplicate on one
> of them:
[...]
> It would feel cleaner to me if I could make FunctionTypes a set and use that
> as the second argument to isinstance. :-)
Does it matter if there is a duplicate entry?
--
Steven
More information about the Python-ideas
mailing list