any idea how i could test if a variable is a floating point number?
aahz at panix.com
Mon Jun 25 10:58:09 EDT 2001
In article <9h76io$ht3$1 at neptunium.btinternet.com>,
Gaz <thecalm at NOSPAM.btinternet.com> wrote:
>any idea how i could test if a variable is a floating point number?
if isinstance(var, type(1.1)):
This is preferred over
if type(var) == type(1.1):
because when the type/class dichotomy gets healed (probably in 2.2), it
will be possible to subclass from float and the second version will fail
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
"Those who do not remember the past are condemned to repeat it."
More information about the Python-list