Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52358

Re: Python Basic Doubt

References (5 earlier) <5206DDED.8030506@islandtraining.com> <CAPTjJmrUGWnQ40iPiJtdKAB8WTbjRaM+bzUmukY6Cb4FvOi2JQ@mail.gmail.com> <5207034A.6070608@islandtraining.com> <CAPTjJmoj5K838vfjuEx9HGDuSb_Uq3=OckqksEk0YsM5Qb4P2w@mail.gmail.com> <CAN1F8qUEugJfufXHFzRiK=0pMiwfWsS4A9fEeugLxvW1QD4ZHg@mail.gmail.com>
Date 2013-08-11 05:38 +0100
Subject Re: Python Basic Doubt
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.465.1376195940.1251.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Aug 11, 2013 at 5:04 AM, Joshua Landau <joshua@landau.ws> wrote:
> On 11 August 2013 04:43, Chris Angelico <rosuav@gmail.com> wrote:
>> The
>> distinction between the two is important when the objects are mutable
>> (so they have an identity that's distinct from their current values).
>
> I don't follow this argument. Tuples are immutable yet you're crazy if
> you check their equality with "is". In Python identity and equality
> are very distinct.

True, it's not strictly an issue of mutability of that one level. But
anything that's truly immutable (a tuple/frozenset of ints/strings)
can in theory be interned. In some languages (no Pythons as far as I'm
aware, though one could easily do so and still be fully compliant),
all strings are automatically interned, so there's no difference
between value and identity for them. A tuple containing a list, for
instance, needs its identity; a tuple of three integers is
identifiable entirely by its value.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python Basic Doubt Chris Angelico <rosuav@gmail.com> - 2013-08-11 05:38 +0100

csiph-web