Dumb python questions

Markus Schaber markus at schabi.de
Wed Aug 15 11:35:42 EDT 2001


Hi,

Richard Jones <richard at bizarsoftware.com.au> schrub:

>>      is_int(3) = 1    # 3 is an integer type
>>      is_int(3L) = 1   # 3L is an integer type
>>      is_int(3.0) = 0  # 3.0 is float type
>>      is_int(3+2j) = 0 # 3+2j is complex type

>   "type(value) == IntType"

>>> type(1L)==IntType
Traceback (innermost last):
  File "<stdin>", line 1, in ?
NameError: IntType

>   "type(value) == type(1)"

doesn't catch the second case:

>>> type(1L)==type(1)
0

Gerson has suggested a working solution.
-- 
1) Customers cause problems.
2) Marketing is trying to create more customers.
Therefore:
3) Marketing is evil.  (Grand Edwards in comp.lang.python)



More information about the Python-list mailing list