6 ms·
Also to add: do people still use "isinstance" for comparing types? Always has help like an antipattern to me.
by angrais 5y ago
Also to add: do people still use "isinstance" for comparing types? Always has help like an antipattern to me.
- anitil 5y agoHow so? Do you mean because it is implicit in it's information rather than explicit? I've been using it a bit for tree structures where an element could be a tree or a leaf, so isintance(node, tuple) is just the ticket. Seems simpler than creating a Node class, and can easily be dumped to json where I need
- dec0dedab0de 5y agoI do, if you do something like type(x) == SomeClass then you won't catch any subclasses of SomeClass