You could cheat and use set:
def all_same( items ):
return len( set( items ) ) == 1 #== len( items )
or you could use:
def all_same( items ):
return all( map(lambda x: x == items[0], items ) )
or if you're dealing with an iterable instead of a list:
def all_same( iterable ):
it_copy = tee( iterable, 1 )
return len( set( it_copy) ) == 1