15 Jun
2004
15 Jun
'04
9:03 p.m.
On Tue, Jun 15, 2004 at 02:00:35PM -0400, Asad Habib wrote:
Hello. Does anyone know of a python function that returns a value based on whether or not its argument is an integer? Any help would be greatly appreciated. Thanks.
pretty trivial to roll your own... I'm assuming you also want it to return true for longs: import types def is_int(arg): return type(arg) in (types.IntType, types.LongType) In zope's Script (Python), you can't do that because type() is not allowed; but you can make do with the same_type function: return same_type(arg, 1) or same_type(arg, 1L) -- Paul Winkler http://www.slinkp.com