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


Groups > comp.lang.python > #8791

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'mrab': 0.05; 'subject:Python': 0.06; '>>>>': 0.09; 'exception.': 0.09; 'subclass': 0.09; 'type)': 0.09; 'subject:] ': 0.14; 'wrote:': 0.15; '(via': 0.16; 'arbitrarily': 0.16; 'element,': 0.16; 'gotta': 0.16; 'lookup': 0.16; 'metaclass': 0.16; 'subject:set': 0.16; '\xc3\xa9crit': 0.16; 'mon,': 0.16; 'pm,': 0.16; '>>>': 0.16; 'cheers,': 0.19; 'header:In-Reply-To:1': 0.22; 'gregory': 0.23; 'received:209.85.213.46': 0.23; 'received:mail- yw0-f46.google.com': 0.23; 'suspect': 0.25; 'raise': 0.28; 'objects': 0.28; 'message-id:@mail.gmail.com': 0.28; 'cases.': 0.30; 'iterating': 0.30; 'types.': 0.30; 'chris': 0.32; 'actually': 0.33; 'to:addr:python-list': 0.34; 'implies': 0.35; 'probably': 0.35; 'anything': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'else': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'back': 0.63; 'making': 0.66; 'exact': 0.69; '10:52': 0.84; '12:53': 0.84; 'beware': 0.84; 'sender:addr:chris': 0.84; 'subject:types': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=gcJED3u9+Tf7PI1L7gPnV8LGGSR5WCIajhf+09FergA=; b=BkRVkgNRvTqjtEmllEu20zMVFv7Xxr7B2gsBckAuFXQREscgWq4XTM6PwuauYVesPi dRzd6MoU64EaOWXPn3ovGzi9rmYfgFo04cSMJ+g7YLpbI2feZkottKc9imLAQJAmcl5s Ih5rQsoDukqJ/zOMp/p/He0A8sRTIRwP26MnE=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <4E121A4B.2040008@mrabarnett.plus.com>
References <CAKCKLWzAgRujAXir8=ZhS2JCaUTzRmzbM9dmOhX_4HxdjH5mGg@mail.gmail.com> <4E11656B.4050908@canterbury.ac.nz> <CAKCKLWynB6-RoHzCnercTy103LKPqcS2fWCrMeyan2Z6BUz5cw@mail.gmail.com> <20110704172843.50c5b445@pitrou.net> <CAGE7PN+KBhEUg=KOxOBaF2=EEQ=Jt=Erq=si1cmYur8TbKtHuw@mail.gmail.com> <CAGE7PNJV0u_4KuQY8ShYpZCnXwEYUhHYAcxRwi6nXTGHgeYxmg@mail.gmail.com> <1309802125.3688.54.camel@localhost.localdomain> <CAGmFidbVGr-sVAzSgXu0SR5cjZgUGbhZBNqSAuWjJNOkjnL3qg@mail.gmail.com> <4E121A4B.2040008@mrabarnett.plus.com>
Date Mon, 4 Jul 2011 13:09:52 -0700
X-Google-Sender-Auth PUAw2KYYSSHTPzcwz8nJCxHYQhk
Subject Re: [Python-ideas] Allow isinstance second argument to be a set of types
From Chris Rebert <clp2@rebertia.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.605.1309810195.1164.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1309810195 news.xs4all.nl 21862 [2001:888:2000:d::a6]:49837
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8791

Show key headers only | View raw


On Mon, Jul 4, 2011 at 12:53 PM, MRAB <python@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.

Cheers,
Chris

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Python-ideas] Allow isinstance second argument to be a set of types Chris Rebert <clp2@rebertia.com> - 2011-07-04 13:09 -0700

csiph-web