var or inout parm?
sturlamolden
sturlamolden at yahoo.no
Fri Dec 12 11:43:31 EST 2008
On Dec 12, 5:13 pm, Steve Holden <st... at holdenweb.com> wrote:
> > It should be the tuple's __setitem__ that was invoked here, not
> > __iadd__, or the parser is faulty.
>
> OK, so now you are proposing to alter the parser, and possibly the
> implementation of the INPLACE_ADD opcode in eval.c, so can you give us
> the patch for those, please?
What? Take a look at the code again:
mytuple[0] += 1
should never attempt an __iadd__ on mytuple.
A sane parser would see this as:
tmp = mytuple.__getitem__(0)
tmp = tmp.__iadd__(1)
mytuple.__setitem__(0, tmp) # should this always raise an exception?
> Discussion of such behavior as a "bug" is also pejorative, since the
> current semantics are the way they are by design.
Right, this bug is by design. You learned that phrase from a guy in
Redmond?
More information about the Python-list
mailing list