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", "gilliam"], as long as they're the > same.
Two suggestions --- First, you can actually do multiple equality testing the way your mathematics teacher would: if a == b == c == d == e == f == g: # do stuff (this grates against my instincts in some ways, since it breaks associativity (because it means 'a == b == c' is different from '(a == b) == c'), but it's in the language, so I guess it's the Right Way). You could also do this: # python2.3: use Set module if set([a,b,c,d,e,f,g]) == set([a]): # do stuff HTH. -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor