On Sun, May 5, 2013 at 12:59 PM, Armin Rigo <arigo@tunes.org> wrote:
Can we fix it once and for all? It's annoying because of id: if we want ``x is y`` for equal huge strings x and y, but still want ``id(x)==id(y)``, then we have to compute ``id(some_string)`` in a rather slow way, producing a huge number. The same for tuples: if we always want ``(1, 2) is (1, 2)`` then we need to compute ``id(some_tuple)`` recursively, which can also lead to huge numbers. In fact such a definition can explode the memory: ``a = (); for i in range(100): a = (a, a); id(a)`` would likely need a 2**100-digits number.
If the "id(x)==id(y)" requirement is removed, does it mean that "x is y" for immutable types is simply "x==y"? So if we have ``a = (); for i in range(100): a = (a, a); b = (a, a)`` then "a is b" will be computationally expensive?