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

2009-07-24 Thread Roy Smith
In article mailman.3674.1248461573.8015.python-l...@python.org, Terry Reedy tjre...@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

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

2009-07-24 Thread Steven D'Aprano
On Fri, 24 Jul 2009 15:03:29 -0400, Roy Smith wrote: In article mailman.3674.1248461573.8015.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: Better:if isinstance(x, (int, float, complex)): I never noticed this before, but it seems odd that the second argument to

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

2009-07-24 Thread Terry Reedy
Steven D'Aprano wrote: On Fri, 24 Jul 2009 15:03:29 -0400, Roy Smith wrote: In article mailman.3674.1248461573.8015.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: Better:if isinstance(x, (int, float, complex)): I never noticed this before, but it seems odd that the second

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

2009-07-24 Thread Duncan Booth
Roy Smith r...@panix.com wrote: In article mailman.3674.1248461573.8015.python-l...@python.org, Terry Reedy tjre...@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

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

2009-07-24 Thread Dr. Phillip M. Feldman
isinstance(x, (int, float, complex)) is certainly very compact, and does what I want. Thanks! -- View this message in context: http://www.nabble.com/len%28%29-should-always-return-something-tp24639361p24654347.html Sent from the Python - python-list mailing list archive at Nabble.com. --