>>>>> John Machin <[email protected]> (JM) wrote:

>JM> On Apr 16, 8:14 am, Chris Rebert <[email protected]> wrote:
>>> 
>>> def all_same(lst):
>>>     return len(set(lst)) == 1
>>> 
>>> def all_different(lst):
>>>     return len(set(lst)) == len(lst)

>JM> @ OP: These are very reasonable interpretations of "all same" and "all
>JM> different" but of course can both return False for the same input.

They can even both return True for the same input!
-- 
Piet van Oostrum <[email protected]>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: [email protected]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to