Skip to content

Comparison using is when operands support __eq__ - #4335

Merged
timgrossmann merged 1 commit into
InstaPy:devfrom
matbrgz:patch-2
Apr 22, 2019
Merged

timgrossmann merged 1 commit into
InstaPy:devfrom
matbrgz:patch-2

Conversation

@matbrgz

@matbrgz matbrgz commented Apr 18, 2019

Copy link
Copy Markdown

Comparison using 'is' when equivalence is not the same as identity

When you compare two values using the is or is not operator, it is the object identities of the two values that is tested rather than their equality. If the class of either of the values in the comparison redefines equality then the is operator may return False even though the objects compare as equal. Equality is defined by the eq or, in Python2, cmp method. To compare two objects for equality, use the == or != operator instead.

Comparison using 'is' when equivalence is not the same as identity
@breuerfelix
breuerfelix changed the base branch from master to dev April 22, 2019 07:06
@breuerfelix
breuerfelix requested review from breuerfelix and removed request for breuerfelix April 22, 2019 07:07
@breuerfelix

Copy link
Copy Markdown
Collaborator

I changed base to dev, PR approved by me, you are totally right, here want to test for equality and not for identity !

@timgrossmann

Copy link
Copy Markdown
Collaborator

@MatheusRV Absolutely true! Thank you for PRing this 馃槉

@breuerfelix Thank you Felix for approving this!

@timgrossmann
timgrossmann merged commit 61c3449 into InstaPy:dev Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants