[Tutor] list objects are unhashable

Kent Johnson kent37 at tds.net
Tue Jul 1 14:42:58 CEST 2008


On Tue, Jul 1, 2008 at 7:03 AM, Norman Khine <norman at khine.net> wrote:
> Kent Johnson wrote:
>> for first in x:
>>  for second in y:
>>    if first and second and (first, second) in table:
>
> I don't really see this clearly as I may have n'th values for 'x' and n'th
> values for 'y' so I will need to loop over all these, but without knowing
> the n'th value where to stop my loop?
>
> Or have I missed the point ;)

I think so, as that is exactly what the for loop will do. For example:
In [1]: x = [1,2, 5]

In [2]: for item in x:
   ...:     print item
   ...:
1
2
5

Kent


More information about the Tutor mailing list