[Python-ideas] Allow isinstance second argument to be a set of types

Michael Foord fuzzyman at gmail.com
Mon Jul 4 00:47:01 CEST 2011

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:

FunctionTypes = (
    # python function
    # instance method
    # unbound method

It would feel cleaner to me if I could make FunctionTypes a set and use that
as the second argument to isinstance. :-)




May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110703/7a3fc43d/attachment.html>

More information about the Python-ideas mailing list