efficent test for array with only one value?
Scott David Daniels
Scott.Daniels at Acm.Org
Tue Jan 20 00:41:38 EST 2004
Kyler Laird wrote:
> Robert Kern <rkern at ucsd.edu> writes:
> ... I'm guessing that reduce
> will not stop immediately when equal encounters a False.
If the early stop is what you want, how about:
if vector:
d = {}
d[vector[0]] = 0
try:
for el in vector:
d[el]
except KeyError:
return False
return True
-Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list