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

Michael Foord fuzzyman at gmail.com
Mon Jul 4 22:31:08 CEST 2011


On 4 July 2011 21:26, Benjamin Peterson <benjamin at python.org> wrote:

> Michael Foord <fuzzyman at ...> writes:
> > I have no *objection* to it working for arbitrary iterables, I just don't
> care
> about it.
> >
> > So does this mean no-one has any objections to my suggested change? I'll
> create an issue.
>
>
> Can you explain why tuple(x) is not sufficient?
>

What is x in that case? Do you mean in the isinstance call? That adds the
runtime overhead of an extra tuple call every time - plus the mental
overhead of reading it every time someone looks at the code. Small maybe,
but it seems like you're suggesting adding bloat...

Seriously though. Conceptually the second argument to isinstance is a set of
types you want to check the object against. It would be nice if that set of
types were permitted to actually be a set.

Michael


>
> It seems like useless bloat to me.
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 

http://www.voidspace.org.uk/

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/20110704/04d6b2f8/attachment.html>


More information about the Python-ideas mailing list