In article <mailman.2298.1384009376.18130.python-l...@python.org>, Chris Angelico <ros...@gmail.com> wrote:
> On Sun, Nov 10, 2013 at 1:37 AM, Roy Smith <r...@panix.com> wrote: > > In article <mailman.2283.1383985583.18130.python-l...@python.org>, > > Chris Angelico <ros...@gmail.com> wrote: > > > >> Some languages [intern] automatically for all strings, others > >> (like Python) only when you ask for it. > > > > What does "only when you ask for it" mean? > > You can explicitly intern a Python string with the sys.intern() > function > [long, and good, explanation of interning] But, you missed the point of my question. You said that Python does this "only when you ask for it". That implies it never interns strings if you don't ask for it, which is clearly not true: $ python Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [...] >>> x = "foo" >>> y = "foo" >>> x is y True I think what you're trying to say is that there are several possible interning policies: 1) Strings are never interned 2) Strings are always interned 3) Strings are optionally interned, at the discretion of the implementation 4) The user may force a specific string to be interned by explicitly requesting it. and that Pike implements #1, while Python implements #3 and #4. -- https://mail.python.org/mailman/listinfo/python-list