On Nov 17, 5:12 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 17 Nov 2008 22:18:51 -0200, Steven D'Aprano > <[EMAIL PROTECTED]> escribió: > > > On Mon, 17 Nov 2008 12:32:35 +0000, Marc 'BlackJack' Rintsch wrote: > > >> Not such illogical crap like > >> ``a = a + 1`` which must be obviously false unless 1 is defined as the > >> neutral element for the definition of ``+`` here. > > > I don't quite know what you mean by "neutral element". I think you mean > > the identity element under addition, which is zero, but that doesn't > > work: > > > 0 = 0 + 1 > > > Obviously not. > > Perhaps you didn't read carefully the above post? He said "unless *1* is > defined as the neutral element for ``+``" > Calling "1" the identity of the "+" operation, or calling "+" an operation > having "1" as its identity element is, errr, uncommon at least, but > perfectly valid... > > -- > Gabriel Genellina
def __add__(self, other): return self + other - 1 Don't tell me this is not "Pythonic"! -- http://mail.python.org/mailman/listinfo/python-list