Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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.

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38362>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to