Is this a bug? I don't know where to start
Diez B. Roggisch
deets at web.de
Wed Jun 22 19:59:49 EDT 2005
jim bardin wrote:
> Is this a python bug, or do i not understand
> something?
>
> http://www.linuxquestions.org/questions/showthread.php?s=&threadid=336118
>
> It seems to me that this should output each value
> once, but i get some seemingly random duplicates.
Your targets contains duplicates - and these produce the problem. And as
>>> print len(all) == len(set(all))
False
shows your alleged " i checked the output of the combination generator
and they're all unique values." is obvously wrong.
Doing this
targets=list(set([97,101,139,41,37,31,29,89,23,19,8,13,131,19,73,97,19,139,79,67,61,17,113,127]))
as first line solves the problem.
Diez
More information about the Python-list
mailing list