On Mon, 06 Jul 2009 22:18:20 -0700, Chris Rebert wrote:
>> Not so rare. Decimal uses unary plus. Don't assume +x is a no-op.
[...]
> Well, yes, but when would you apply it twice in a row?
My point was that unary + isn't a no-op, and therefore neither is ++. For
Decimal, I can't think why you'd want to apply ++x, but for other
objects, who knows?
Here's a toy example:
>>> class Spam(str):
... def __pos__(self):
... return self.__class__("spam " + self)
...
>>> s = Spam("")
>>> ++++s
'spam spam spam spam '
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list