Multiple isinstance calls

isinstance can take multiple types, so there is no need to call them multiple times for each type.

isinstance return True if the first argument is an instance or a subclass of specified type/types.

Given that these result in the same outcome:

Why not choose the easiest to read, write, and execute (the first one)?

Note also that as of Python 3.10, isinstance also accepts Union Type:

If our GitHub code review bot spots this issue in your pull request it gives this advice:

code-review-doctorbotsuggested changes just now
validation.py
1
+
if isinstance(item, int) or isinstance(item, float):

isinstance can take multiple types, so there is no need to call them multiple times for each type.

Read more
Suggested changes
-
if isinstance(item, int) or isinstance(item, float):
+
if isinstance(item, (int, float)):
Commit suggestion
2
+
    pass
Update validation.py

Instantly check if you have this issue for free

    Works with tools you use

    Read about how it works.