> > How can I check if a variable is an integer?
>
> Luke and John have answered your question, but we should also
> ask, why
> do you want to do that? Explicit type testing is a code
> smell, perhaps
> there is a better way to do what you want.
>
> Kent
>
Kent,
Can you explain further? Refactoring is in my queue of books to read. In
a web app I'm writing, I'm checking the input kind of like this...
try:
form_value = int(form.getvalue('num_widgets')
except ValueError:
display_error("Number of Widgets must be a number")
Mike
-------------
NOTICE: This e-mail transmission and any documents or files attached to
it contain information for the sole use of the above-identified individual or
entity.
Its contents may be privileged, confidential, and exempt from disclosure
under the law.
Any dissemination, distribution, or copying of this communication is strictly
prohibited.
Please notify the sender immediately if you are not the intended recipient.
FGNS
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor