Avoiding local variable declarations?

Russ P. Russ.Paielli at gmail.com
Tue Nov 18 02:27:54 CET 2008


On Nov 17, 5:12 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Mon, 17 Nov 2008 22:18:51 -0200, Steven D'Aprano
> <ste... at remove.this.cybersource.com.au> 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"!






More information about the Python-list mailing list