check types with isinstance; allow tuple, where possible #770
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dear Jack,
I stumbled upon a bad practice of checking the object type with
type(x) == y
. Also, a handy-used scenario is when the user populates a dict with keys as legend labels and values as the payload:In short, legend sometimes can be passed as a tuple rather than a list, and I thought there is nothing wrong with allowing tuples.
How Has This Been Tested?
Tested by running the demo script.
Types of changes
Checklist:
P.S. It ain't much, but it's honest work.
P.P.S. When I was fixing the bad practice here and there, I noticed some other small issues with the coding style like code duplication, old python usage, etc. At first, I felt tempted to dive deeply into fixing them all but noticed #675, which, of course, should be merged before any further sugar-code fixes.
P.P.P.S. One could set up Travis or CircleCI builds like I'm doing here to finally test the changes properly on each PR. I can write CircleCI build script if you set up a server.
Best,
Danylo