Possible duplicate:
How does Python compare string and int?
I did some comparison in Python. I was surprised to see that I can compare a string with an integer. then I made an identifier and found out that in fact the identifier for the string is greater than the id for int, and I thought that the reason I get this output.
In [19]: 'a' < 3
Out[19]: False
In [20]: 'a'>3
Out[20]: True
In [17]: id('a')
Out[17]: 140414909035824
In [18]: id(3)
Out[18]: 23119752
Please confirm that I am interpreting this behavior correctly (comparing Python with id level).
Varun source
share