Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8790 > unrolled thread

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

Started byMRAB <python@mrabarnett.plus.com>
First post2011-07-04 20:53 +0100
Last post2011-07-04 20:53 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [Python-ideas] Allow isinstance second argument to be a set of types MRAB <python@mrabarnett.plus.com> - 2011-07-04 20:53 +0100

#8790 — Re: [Python-ideas] Allow isinstance second argument to be a set of types

FromMRAB <python@mrabarnett.plus.com>
Date2011-07-04 20:53 +0100
SubjectRe: [Python-ideas] Allow isinstance second argument to be a set of types
Message-ID<mailman.604.1309809227.1164.python-list@python.org>
On 04/07/2011 20:41, Amaury Forgeot d'Arc wrote:
> Hi,
>
> 2011/7/4 Antoine Pitrou<solipsis@pitrou.net>:
>> Le lundi 04 juillet 2011 à 10:52 -0700, Gregory P. Smith a écrit :
>>> note that a fast lookup implies exact type and not subclass making my
>>> point silly... at which point you're back to iterating so I suspect
>>> supporting arbitrary iterables is actually how this will be
>>> implemented regardless.
>>
>> Indeed. Note that the tuple case should remain fast, and therefore
>> special-cased (or the general list/tuple case, since the difference in C
>> is rather small).
>
> Arbitrary iterables, arbitrarily nested...
> beware of objects which are also their first element, like str('a')...
>
Probably not arbitrarily nested, just a type (type(t) is type) or an
iterable yielding types. Anything else would raise an exception.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web