Re: __setitem__ without position

Discussion in 'Python' started by Ethan Furman, Oct 12, 2012.

  1. Ethan Furman

    Ethan Furman Guest

    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~
     
    Ethan Furman, Oct 12, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Angel

    Re: __setitem__ without position

    Dave Angel, Oct 11, 2012, in forum: Python
    Replies:
    0
    Views:
    213
    Dave Angel
    Oct 11, 2012
  2. Ian Kelly

    Re: __setitem__ without position

    Ian Kelly, Oct 11, 2012, in forum: Python
    Replies:
    0
    Views:
    141
    Ian Kelly
    Oct 11, 2012
  3. Terry Reedy

    Re: __setitem__ without position

    Terry Reedy, Oct 12, 2012, in forum: Python
    Replies:
    0
    Views:
    185
    Terry Reedy
    Oct 12, 2012
  4. Ethan Furman

    Re: __setitem__ without position

    Ethan Furman, Oct 12, 2012, in forum: Python
    Replies:
    0
    Views:
    116
    Ethan Furman
    Oct 12, 2012
  5. Peter Otten

    Re: __setitem__ without position

    Peter Otten, Oct 12, 2012, in forum: Python
    Replies:
    0
    Views:
    124
    Peter Otten
    Oct 12, 2012
Loading...

Share This Page