[issue37728] 'is' behaving differently in script and interactive shel

2019-07-31 Thread Eryk Sun
Eryk Sun added the comment: The CPython interpreter doesn't centrally cache and reuse float objects, and even if it did that would be an implementation detail, like what it does with small int objects and strings. What you're seeing at the module level is a compilation side effect. The com

[issue37728] 'is' behaving differently in script and interactive shel

2019-07-31 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi rathinavelu thiruvenkatam, cPython has some optimizations where some immutable constants will be folded in the same object to save memory so this is not a bug, it's just that those optimization are not run when typing directly in the shell. You should just

[issue37728] 'is' behaving differently in script and interactive shel

2019-07-31 Thread rathinavelu thiruvenkatam
New submission from rathinavelu thiruvenkatam : af=1.1 bf=1.1 print(f'{af==bf},{af is bf}, {bf is af}' ) """ Script outputs True,True, True. On Shell af=1.1 bf=1.1 print(f'{af==bf},{af is bf}, {bf is af}' ) True,False, False """ -- messages: 348790 nosy: rathinavelu thiruvenkatam