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


Groups > comp.lang.python > #31142 > unrolled thread

Re: __setitem__ without position

Started byEthan Furman <ethan@stoneleaf.us>
First post2012-10-11 16:23 -0700
Last post2012-10-11 16:23 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#31142 — Re: __setitem__ without position

FromEthan Furman <ethan@stoneleaf.us>
Date2012-10-11 16:23 -0700
SubjectRe: __setitem__ without position
Message-ID<mailman.2076.1349999473.27098.python-list@python.org>
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~

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web