__setitem__ without position

Ethan Furman ethan at stoneleaf.us
Thu Oct 11 19:23:03 EDT 2012


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~



More information about the Python-list mailing list