list vs. tuple [Re: len() should always return something]

Roy Smith roy at panix.com
Fri Jul 24 15:03:29 EDT 2009


In article <mailman.3674.1248461573.8015.python-list at python.org>,
 Terry Reedy <tjreedy at udel.edu> wrote:

> Better:    if isinstance(x, (int, float, complex)):

I never noticed this before, but it seems odd that the second argument to 
isinstance() should be a tuple.  Using the normal arguments made about 
tuples vs. lists, it seems like a list would be the right data structure 
here.  I suppose a set would be even more right, but (I'm pretty sure) 
isinstance() predates sets.

I'm curious why a tuple was chosen.



More information about the Python-list mailing list