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


Groups > comp.lang.python > #99827

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

From Erik <python@lucidity.plus.com>
Newsgroups comp.lang.python
Subject Re: Could you explain this rebinding (or some other action) on "nums = nums"?
Date 2015-12-01 22:44 +0000
Message-ID <mailman.91.1449009930.14615.python-list@python.org> (permalink)
References (3 earlier) <mailman.51.1448940760.14615.python-list@python.org> <n3l050$l7a$4@dont-email.me> <mailman.83.1449002726.14615.python-list@python.org> <n3l3vk$l7a$6@dont-email.me> <565E2065.1050704@lucidity.plus.com>

Show all headers | View raw


Apologies for self-replying,

On 01/12/15 22:34, Erik wrote:
>  what you're asking for is that
> the *container* object whose element is being assigned to is first
> queried as to whether it will accept a mutated element being assigned to
> it before that element is mutated.

What I said above is rubbish. The situation is approximately similar to:

a = [4, 5, 6]
t = ([1, 2, 4], a)
a.append(7)
a.append(8)
a.append(9)

The point is, you're mutating something that an immutable object 
contains. In the example you give, that's caught because of the 
subsequent explicit assignment.

In the example above, it's not caught. But it's the same thing.

E.

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


Thread

Re: Could you explain this rebinding (or some other action) on "nums = nums"? fl <rxjwg98@gmail.com> - 2015-11-30 18:14 -0800
  Re: Could you explain this rebinding (or some other action) on "nums = nums"? MRAB <python@mrabarnett.plus.com> - 2015-12-01 03:32 +0000
    Re: Could you explain this rebinding (or some other action) on "nums = nums"? Denis McMahon <denismfmcmahon@gmail.com> - 2015-12-01 20:32 +0000
      Re: Could you explain this rebinding (or some other action) on "nums = nums"? Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-01 14:44 -0600
        Re: Could you explain this rebinding (or some other action) on "nums = nums"? Denis McMahon <denismfmcmahon@gmail.com> - 2015-12-01 21:37 +0000
          Re: Could you explain this rebinding (or some other action) on "nums = nums"? Erik <python@lucidity.plus.com> - 2015-12-01 22:34 +0000
          Re: Could you explain this rebinding (or some other action) on "nums = nums"? Erik <python@lucidity.plus.com> - 2015-12-01 22:44 +0000
      Re: Could you explain this rebinding (or some other action) on "nums = nums"? Terry Reedy <tjreedy@udel.edu> - 2015-12-01 16:18 -0500
        Re: Could you explain this rebinding (or some other action) on "nums = nums"? Denis McMahon <denismfmcmahon@gmail.com> - 2015-12-01 21:36 +0000
          Re: Could you explain this rebinding (or some other action) on "nums = nums"? Terry Reedy <tjreedy@udel.edu> - 2015-12-01 17:37 -0500

csiph-web