Reputation: 1437
I would like to use if type(x) not list
instead of if not isinstance(x, list)
Am I missing something?
if not isinstance(x, list)
seems excessive
since I'm not checking for class inheritance.
Upvotes: 0
Views: 65
Reputation: 1124090
You forgot the is
:
if type(x) is not list:
but if not isinstance(x, list)
is not excessive, really. You should always allow for subclasses, it'll make your life easier at some point. Why close the door on that option?
Upvotes: 5