On Sat, Aug 10, 2013 at 7:00 PM, Xavi <jara...@gmail.com> wrote: > 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.
This really should be a separate thread, rather than a follow-up to the previous one, since it's quite unrelated. But anyway. The isinstance check is the better one, because it will also accept a subclass of list, which the others won't. ChrisA -- http://mail.python.org/mailman/listinfo/python-list