Re: [Tutor] What's going on in this Python code from Programming Collective Intelligence?

2013-07-10 Thread Alan Gauld
On 10/07/13 13:05, Dave Angel wrote: mylist = [(row[0],0) for row in rows] I'll guess it's the list comprehension that confuses you. That line is roughly equivalent to: mylist = [] for row in rows: mylist.append( (row[0], row) ) Except the second element in the tuple to append should be

Re: [Tutor] What's going on in this Python code from Programming Collective Intelligence?

2013-07-10 Thread Dave Angel
On 07/06/2013 11:18 PM, bluepresley wrote: I'm reading the book Programming Collective Intelligence by Toby Segaran. I'm having a lot of difficulty understanding the some of the code from chapter four (the code for this chapter is available online at https://github.com/cataska/programming-collect

[Tutor] What's going on in this Python code from Programming Collective Intelligence?

2013-07-10 Thread bluepresley
I'm reading the book Programming Collective Intelligence by Toby Segaran. I'm having a lot of difficulty understanding the some of the code from chapter four (the code for this chapter is available online at https://github.com/cataska/programming-collective-intelligence-code/blob/master/chapter4/se