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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timx 332 dedupe function #206
Timx 332 dedupe function #206
Changes from 1 commit
2871769
f81475b
0448d3b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple requests here.
First, I think this approach might actually creating a tuple with the individual characters of the class name, e.g.
Think this could be resolved via an explicit list, and then converting to tuple:
Second, any objection with using
X.__class__
vstype(X)
?Example:
Personally, when we know it's some kind of well-known class instance (like classes we define), I think using
.__class__
is more readable. I'm having trouble finding supporting documentation or reasoning, where it sounds liketype(X)
andX.__class__
are mostly interchangeable; this SO post being a good example where it's kind of fluid, matter of taste, and some pretty edge-y gotchas.I tend to think of
type(X)
as when I really don't know anything about an object. But in this case, where we know it's a class instance of some kind, and we wrote the classes, it feels like accessing it directly is kind of nice.TL/DR: I'd propose we make the first change to avoid a tuple of each character, but the second
type(X)
vsX.__class__
happy either way.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALL that said -- and should have led with this -- this is a nice and elegant solution to this equality checking! Nice work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider
values = tuple([timdex_object.__class__.__name__])
more readable as well, good suggestion!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EGAD 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghukill Thank you for catching this erroneous error 🙈 . This has been fixed by 426b185. I also prefer using
__class__
for the same reason you described:(Also remembering you suggested this during our check-in yesterday so apologies for forgetting!)