This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients steven.daprano, xtreak, Светломир Балевски
Date 2019-10-03.12:51:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1570107079.14.0.955782891773.issue38362@roundup.psfhosted.org>
In-reply-to
Content
This is nothing to do with platform.system. You can see the same behaviour with any string comparison, or ints.

The `is` operator is not a cute way of spelling `==`, it tests for object identity, not equality. It tests whether the two arguments are the same object. The Python interpreter caches some strings, and some ints, to save memory, so the result of ``expression is "somestring"`` will depend on the operating system, the version of Python, what happens to be in the cache, and whatever memory optimization tricks are being used by the interpreter.

Never use ``is`` for testing whether two things are equal. Only use it for testing object identity, like ``obj is None``.

By the way, this question about ``is`` has been asked many, many times on places like Stackoverflow. If you have any further questions about this, you should check the answers there.
History
Date User Action Args
2019-10-03 12:51:19steven.dapranosetrecipients: + steven.daprano, xtreak, Светломир Балевски
2019-10-03 12:51:19steven.dapranosetmessageid: <1570107079.14.0.955782891773.issue38362@roundup.psfhosted.org>
2019-10-03 12:51:19steven.dapranolinkissue38362 messages
2019-10-03 12:51:19steven.dapranocreate