duffel-api-python icon indicating copy to clipboard operation
duffel-api-python copied to clipboard

Use isinstance rather than type when type-checking

Open richcooper95 opened this issue 3 years ago • 0 comments

Describe the bug Some places use type() instead of isinstance() when checking types (e.g. here). Using isinstance() is preferred because it's faster and also considers inheritance (and you’d probably want to still consider subclasses of dict as true in that example above - e.g. if we wanted to use an OrderedDict).

To Reproduce n/a

Expected behavior Check types with isinstance() instead.

System (please complete the following information): n/a

Additional context n/a

richcooper95 avatar Feb 02 '22 16:02 richcooper95