[Tutor] all elements equal in tuple or list

Dick Moores rdm at rcblue.com
Fri Nov 19 02:57:25 CET 2004


Kent, I'm having trouble getting my mind around this. Why do you use "if 
vals"?

Thanks,

Dick

Kent Johnson wrote at 09:15 11/18/2004:
>def test(vals):
>     if vals:
>         i = iter(vals)
>         first = i.next()
>         for item in i:
>             if first != item:
>                 return False
>     return True



More information about the Tutor mailing list