What's the difference?

Terry Reedy tjreedy at udel.edu
Thu Jun 10 19:27:33 EDT 2010


On 6/10/2010 4:47 PM, Anthony Papillion wrote:
> Someone helped me with some code yesterday and I'm trying to
> understand it. The way they wrote it was
>
> subjects = (info[2] for info in items)

This is more or less equivalent to

def _():
     for item in items:
         yield info[2]
subjects = _()
del _

Terry Jan Reedy





More information about the Python-list mailing list