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


Groups > comp.lang.python > #31142

Re: __setitem__ without position

Date 2012-10-11 16:23 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: __setitem__ without position
References <CA+C4C6c7GBdxs+jZPGNrpauvZXP7caGpPb8Q466HD7mV09731Q@mail.gmail.com> <CA+C4C6eMKa6i4Vk4b7hc8SxyDyutoRKkP9VLt0g3UWs+v5ehTw@mail.gmail.com> <50773AE5.7020400@davea.name> <CA+C4C6fZJMUtwyxsRdDTKzzEQWtxrYVpDT6chn1-yyF8VDK9og@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2076.1349999473.27098.python-list@python.org> (permalink)

Show all headers | View raw


Kevin Anthony wrote:
> I'm not supprised... and understand why it's happening.  I'm asking how 
> to get around it.

I don't think you do understand what's happening.

What's happening is the basic application of name binding in Python:

--> C = anything

whatever C was bound to before, it no longer is, because now it is bound 
to <anything>.

What you are trying to do is mutate C, not rebind it.  As Dave 
suggested, you can use slice notation ([:]) or some method of C (that 
you create) to do so.


> Basically i'm asking how to override, if i can, the `=`

You can't.

~Ethan~

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


Thread

Re: __setitem__ without position Ethan Furman <ethan@stoneleaf.us> - 2012-10-11 16:23 -0700

csiph-web