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


Groups > comp.lang.python > #99824

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:34 +0000
Message-ID <mailman.88.1449009296.14615.python-list@python.org> (permalink)
References (2 earlier) <b48d4b38-a28a-4408-8271-f79e850f453f@googlegroups.com> <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>

Show all headers | View raw


On 01/12/15 21:37, Denis McMahon wrote:
> The assignment succeeds. That's imo a bug. If it's a TypeError to try and
> assign a value to tup[1], then tup[1] should not allow the mutated list
> to be assigned.

Nothing got assigned.

That original list object remains in that slot. However, it has been 
mutated since it was originally assigned.

But I can see what you're getting at - 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.

This looks to be a fundamental issue with the augmented assignment 
mechanism.

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