[Python-ideas] Allow isinstance second argument to be a set of types
fuzzyman at gmail.com
Mon Jul 4 23:48:55 CEST 2011
On 4 July 2011 22:08, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Mon, 4 Jul 2011 21:41:33 +0200
> "Amaury Forgeot d'Arc"
> <amauryfa at gmail.com> wrote:
> > Hi,
> > 2011/7/4 Antoine Pitrou <solipsis at 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
> > > is rather small).
> > Arbitrary iterables, arbitrarily nested...
> > beware of objects which are also their first element, like str('a')...
> Ouch. I guess that shoots the proposal dead in the water, then.
Why? Iteration doesn't imply recursing into contained iterators.
> Python-ideas mailing list
> Python-ideas at python.org
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...
More information about the Python-ideas