On Mon, 24 Dec 2007 18:01:53 -0800, Raymond Hettinger wrote: >> Currently, Python raises an error *and* changes the first element of >> the tuple. Now, this seems like something one would want to change - >> why raise an error *and* execute the thing it was complaining about? > > Yawn. Multiple actions have been combined into one line.
And this is a good idea? > The first succeeds and the second fails. And this is a good idea? Shouldn't the tuple assignment raise the exception BEFORE calling __iadd__ on the item, instead of after? > If you need commit-rollback behaviors, specify them explicitly in a > try/except. My bet is that you'll figure-out that you didn't really > need that behavior to begin with. No use cluttering and slowing the > language for something like this -- Python is not SQL. Who said anything about commit-rollbacks? But even if Python is not SQL, operations that half-succeed are a PITA whenever they can occur, because you end up having to code around them in all sorts of complicated and ugly ways. Either that, or you end up with odd corner cases hiding bugs. I was never a big fan of augmented assignments. I think it goes against the Python grain: it's an implied operation, using punctuation, for the sole (?) benefit of saving a keystroke or three. But I think this behaviour counts as a wart on the language, rather than a bug. -- Steven -- http://mail.python.org/mailman/listinfo/python-list