Thanks to all who responded on this. The commonly suggested:
> if a == b == c == d == e == f == g:
> do stuff
Is just what I needed. It never occurred to me that Python supported a
construct like that. I would have though this would have evaulated a la:
if ((a == b) == c) == d) == e)
> > Suppose I have several variables, e.g.: a, b, c, d, e, f, g.
> >
> > I would like to be able to see if they're all the same, I don't care
> > what the value is, as long as they're equal. If they're all equal to
> > 0, or to "spam", or to ["cleese", "idle", "gilliam"], as long as
> > they're the
> Is there a more pythonic way of doing this other than,
>
> if (a == b &
> a == c &
> a == d &
> a == e &
> a == f &
> a == g):
> do stuff
You don't want to use & coz its a bitwise comparison,
so you should use 'and'
if a == b and
a == c and
...
However you
On May 15, 2005, at 06:54, Terry Carroll wrote:
> if (a == b &
> a == c &
> a == d &
> a == e &
> a == f &
> a == g):
> do stuff
>
Well, you can already try this:
if a == b == c == d == e == f == g:
do stuff
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"
Quoting Terry Carroll <[EMAIL PROTECTED]>:
> Suppose I have several variables, e.g.: a, b, c, d, e, f, g.
>
> I would like to be able to see if they're all the same, I don't care
> what the value is, as long as they're equal. If they're all equal to 0, or
> to "spam", or to ["cleese", "idle", "gi
Suppose I have several variables, e.g.: a, b, c, d, e, f, g.
I would like to be able to see if they're all the same, I don't care what
the value is, as long as they're equal. If they're all equal to 0, or to
"spam", or to ["cleese", "idle", "gilliam"], as long as they're the same.
Is there a mo