Python 3 isinstance
pavlovevidence at gmail.com
Thu Jan 15 22:43:37 CET 2009
On Jan 15, 1:08 pm, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
> Carl Banks <pavlovevide... at gmail.com> wrote:
> > I don't see what the big deal is. Right now isinstance accepts a type
> > or a tuple of types. The code could be changed to allow a type, or
> > any iterable the returns types (wherein every items of the sequence is
> > required to be a type). What's messy about that?
> No, it isn't restricted to a type or a tuple of types: right now isinstance
> accepts X where X is a type or a tuple of X. The definition is recursive,
> and the data structure can be deeply nested, but (because tuples are
> immutable) it cannot be infinite.
> e.g.>>> isinstance('x', (((((int, (float, str)),),),),))
Oh. Not sure what the use case for THAT was, but that would make
More information about the Python-list