On Tue, Aug 14, 2018 at 10:25 AM, David Mertz <me...@gnosis.cx> wrote:

> Great work! There are a few typos, I'll try to get to a PR on those.
>
> I wonder if it's worth noting that None is a singleton, while 42 is just a
> value. I.e. there might be several distinct objects that happen to be the
> int 42, but not so with None.
>

very much worth nothing -- and I think re-wording that example. The fact
that you can't assign to None is orthogonal to the fact that it's immutable.

in fact, [42] is a llteral for a list with one element, the integer with
the value of 42 in it. It is very much a mutable. and yet:

In [7]: [42] = 34
  File "<ipython-input-7-b919f2b4d30d>", line 1
    [42] = 34
SyntaxError: can't assign to literal

whereas:

[5].append(3)

works -- at least it does not result in an error -- even though it's
useless.

And the reason this matters is that name binding (and rebinding) is very
much a different operation than mutating -- we should not conflate those.

-CHB


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to