News for hackers. Stuff that matters.
Re:Python strings are immutable, but only sometimes by th0ma5 on Monday February 15, 2021 @04:47PM (#26147898)
This is outside of the spec... "is" is for testing the exact same reference and it is only coincidence that to speed things up they made smaller integers the same objects in memory. See:

    >>> a=257
    >>> b=a
    >>> a is b
    True
What you want is double equals.
Re:Python strings are immutable, but only sometimes by oivey on Monday February 15, 2021 @05:15PM (#26148222)
He names references in his post. I highly doubt he’s confused about the difference between is and ==. It’s a weird leak of interpreter details that could, in very narrow situations, cause a bug.
Re:Python strings are immutable, but only sometimes by th0ma5 on Tuesday February 16, 2021 @01:07PM (#26156838)
The language never said you could do this.