Pete Forman petef4+usenet at
Tue Feb 5 10:49:06 CET 2013

Steven D'Aprano <steve+comp.lang.python at> writes:
>> I want to check that a value is a number. [...]
> I'm leaning towards an isinstance check

Well that is the answer to your question, whether the value *is* a
number. EAFP can answer the question whether the value *behaves* like a
number, where the criterion depends on what your code is aiming to do
with the value.

BTW what if the value is Not-a-Number? ;-)

Pete Forman

More information about the Python-list mailing list