[Python-ideas] Allow isinstance second argument to be a set of types
clp2 at rebertia.com
Mon Jul 4 22:09:52 CEST 2011
On Mon, Jul 4, 2011 at 12:53 PM, MRAB <python at mrabarnett.plus.com> wrote:
> On 04/07/2011 20:41, Amaury Forgeot d'Arc wrote:
>>> 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.
>> 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.
What about a type that is itself iterable (via metaclass magic)?
Gotta consider the wacky edge cases.
More information about the Python-list