Fabian Steiner wrote:
> Hello!
> 
> So far, I am using something like »if isinstance(var, int):« to 
> determine, whether var's value is an integer. Now I would like to know 
> if there is any better possibility to do such general checks or may a 
> construct with isinstance() even fail in certain cases?

The general rule is: don't check, let it fail if it wants to.
If you are looking for an integral value check, you might prefer:

    isinstance(x, (int, long))

but again, think long and hard about your requirements.  Embrace
dynamic typing; don't try to write your old language in Python.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to