[Zope] Checking for an Integer Argument
Asad Habib
ahabib at engin.umich.edu
Thu Jun 30 17:04:31 EDT 2005
Is there any way to check if an argument is an integer in Python?
Offcourse, there is the int function but it chokes when passed an argument
that is not a string and then the user is inconvenienced (it throws a
ValueError to be specific). I guess I could check each digit of the
integer to determine if its ASCII value falls within the appropriate range
and if each digit passed this test, then the entire number would be an
integer. Does anyone know of a simpler way that involves use of a
predefined Python function? Likewise, does anyone know if a similar
function exists to detect floating point numbers? Any help would be
appreciated. Thanks.
- Asad
More information about the Zope
mailing list