Python Basic Doubt

Xavi jarabal at gmail.com
Sat Aug 10 14:00:58 EDT 2013


Hello,

El 10/08/2013 18:40, Tim Chase escribió:
> Generally, if you are using the "is" operator to compare against
> anything other than None, you're doing it wrong. There are exceptions
> to this, but it takes knowing the particulars.

Now I have one doubt, I use 'is' to compare basic types in python 3, for example .-

v = []
if type(v) is list:
     print('Is list...')

Because I think it is more clear and faster than .-
type(v) == [].__class__  ... or ... isinstance(v, list)

Is this correct?
Thanks.
-- 
Xavi



More information about the Python-list mailing list