Closed turettn closed 4 years ago
In 2010 is meant == plus type check if I remember correctly. Do you know when python changed it to identity check?
Adrian
On Wed, 12 Aug 2020 at 21:44 Coveralls notifications@github.com wrote:
[image: Coverage Status] https://coveralls.io/builds/32713953
Coverage remained the same at 89.557% when pulling 0230180 https://github.com/adriank/ObjectPath/commit/02301807cb7fe142152f93e31cbd8c1c6f341f14 on turettn:is_literal_warnings into 445744a https://github.com/adriank/ObjectPath/commit/445744a98aa1c913f7f188421cd5c27cadedaabf on adriank:master.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/adriank/ObjectPath/pull/101#issuecomment-673073138, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABLE4SKBJPTXYGMX3JWXTTSALWIPANCNFSM4P5GCMFA .
-- Greetings, Adrian Kalbarczyk
This seems to go back to at least Python 2.0:
The operators is and is not test for object identity: x is y is true if and only if x and y are the same object. x is not y yields the inverse truth value.
Depending on your implementation of python, is
may behave like a value + type check, but it's not guaranteed to.
@adriank Any chance to have this fix as a new version?
This PR was merged almost a year ago. Have you found other occurrences of is/is not in the code?
This PR was merged almost a year ago. Have you found other occurrences of is/is not in the code?
I am using 0.6.1
version of the objectpath
which is the latest one available on pypi and it seems this fix is not included.
@adriank Could you release a new version on PyPI that contains this change?
Starting with python 3.8, using
is
oris not
to compare with a literal throws a SyntaxWarning.All the details can be found here:
https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/
This commit replaces the identity check with an equality check.