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 roccosan
Recipients roccosan, terry.reedy
Date 2019-04-04.12:28:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554380923.58.0.948935452429.issue36524@roundup.psfhosted.org>
In-reply-to
Content
Hi all

Why the identity operator and '=='  are both applied to the type (see above)? Is it not convenient to distinguish them? I mean the identity operator  applied to the type and '==' applied to the outcome.
Thanks for the attention
Best regards
Rocco Santoro

Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import math
>>> x = math.log(10000000)
>>> y = math.log(10)
>>> print(x/y) == x/y
7.0
False
>>> print(math.log(10000000)/math.log(10)) == math.log(10000000)/math.log(10)
7.0
False
>>> x = math.sin(32)
>>> y = math.cos(41)
>>> print(y/x) == y/x
-1.7905177807148493
False
>>> x = math.pi
>>> y = math.tau
>>> x/y == print(x/y)
0.5
False
>>> x = 153
>>> y = 245
>>> print(x/y) == x/y
0.6244897959183674
False
>>> print(x+y) == x + y
398
False
>>> print(x*y) == x*y
37485
False
>>> s1 = 'Hello, '
>>> s2 = 'how are you?'
>>> print(s1 + s2) == s1 + s2
Hello, how are you?
False
>>> print(s1 + s2) is s1 + s2
Hello, how are you?
False
>>> type(print(s1 + s2))
Hello, how are you?
<class 'NoneType'>
>>> type(s1 + s2)
<class 'str'>
>>> type(print(y/x))
1.6013071895424837
<class 'NoneType'>
>>> type(x/y)
<class 'float'>
History
Date User Action Args
2019-04-04 12:28:43roccosansetrecipients: + roccosan, terry.reedy
2019-04-04 12:28:43roccosansetmessageid: <1554380923.58.0.948935452429.issue36524@roundup.psfhosted.org>
2019-04-04 12:28:43roccosanlinkissue36524 messages
2019-04-04 12:28:43roccosancreate