Re: [Python-Dev] inplace operators and __setitem__

2005-09-29 Thread Pierre Barbier de Reuille
Ok, so I took a closer look at the documentation and tried a few things to understand better what you said and I have some remark ... Phillip J. Eby a ecrit : At 06:15 PM 9/28/2005 +0200, Pierre Barbier de Reuille wrote: Regularly, you see questions about augmented assignment on Python-tutor

Re: [Python-Dev] inplace operators and __setitem__

2005-09-29 Thread Aahz
On Thu, Sep 29, 2005, Pierre Barbier de Reuille wrote: Ok, so I took a closer look at the documentation and tried a few things to understand better what you said and I have some remark ... I've got some counter-remarks, but python-dev is not the place to discuss them. Please move this thread

Re: [Python-Dev] inplace operators and __setitem__

2005-09-29 Thread Pierre Barbier de Reuille
Done :) I summarized my point of view and I'm waiting for comments :) Pierre Aahz a écrit : On Thu, Sep 29, 2005, Pierre Barbier de Reuille wrote: Ok, so I took a closer look at the documentation and tried a few things to understand better what you said and I have some remark ... I've

[Python-Dev] inplace operators and __setitem__

2005-09-28 Thread Reinhold Birkenfeld
Hi, a general question. Consider: class A(list): def __setitem__(self, index, item): # do something with index and item return list.__setitem__(self, index, item) lst = A([1,set()]) lst[0] |= 1 lst[1] |= set([1]) Do we want lst.__setitem__ to be called in the second

Re: [Python-Dev] inplace operators and __setitem__

2005-09-28 Thread James Y Knight
On Sep 28, 2005, at 9:12 AM, Reinhold Birkenfeld wrote: Hi, a general question. Consider: class A(list): def __setitem__(self, index, item): # do something with index and item return list.__setitem__(self, index, item) lst = A([1,set()]) lst[0] |= 1 lst[1] |=

Re: [Python-Dev] inplace operators and __setitem__

2005-09-28 Thread Phillip J. Eby
At 03:12 PM 9/28/2005 +0200, Reinhold Birkenfeld wrote: Hi, a general question. Consider: class A(list): def __setitem__(self, index, item): # do something with index and item return list.__setitem__(self, index, item) lst = A([1,set()]) lst[0] |= 1 lst[1] |= set([1])

Re: [Python-Dev] inplace operators and __setitem__

2005-09-28 Thread Pierre Barbier de Reuille
Phillip J. Eby a écrit : At 03:12 PM 9/28/2005 +0200, Reinhold Birkenfeld wrote: [...] Yes. See: http://www.python.org/2.0/new-python.html#SECTION00070 The purpose of the augmented assignment forms is to allow for the possibility that the item's __i*__ method may or may

Re: [Python-Dev] inplace operators and __setitem__

2005-09-28 Thread Phillip J. Eby
At 05:15 PM 9/28/2005 +0200, Reinhold Birkenfeld wrote: Okay. I assume that we must accept that s = set() t = (s,) t[0] |= set([1]) changes s in spite of raising TypeError. There are lots of operations that can be partially completed before raising an error, so I'm not sure why this case would

Re: [Python-Dev] inplace operators and __setitem__

2005-09-28 Thread Phillip J. Eby
At 05:40 PM 9/28/2005 +0200, Pierre Barbier de Reuille wrote: Rather than closing this as invalid, it would be wiser to update the documentation before ! Nothing corresponds to the current behavior. I got my information from here:

Re: [Python-Dev] inplace operators and __setitem__

2005-09-28 Thread Pierre Barbier de Reuille
Phillip J. Eby a écrit : At 05:40 PM 9/28/2005 +0200, Pierre Barbier de Reuille wrote: Rather than closing this as invalid, it would be wiser to update the documentation before ! Nothing corresponds to the current behavior. I got my information from here:

Re: [Python-Dev] inplace operators and __setitem__

2005-09-28 Thread Phillip J. Eby
At 06:15 PM 9/28/2005 +0200, Pierre Barbier de Reuille wrote: Regularly, you see questions about augmented assignment on Python-tutor mailing list, I often have question in my lab because of problems ... most of the time people learn to avoid these operators in the end ! And my look in the