What does a for loop within a list do in Python?

Viewed 90859

Can someone explain the last line of this Python code snippet to me?

Cell is just another class. I don't understand how the for loop is being used to store Cell objects into the Column object.

class Column(object):

    def __init__(self, region, srcPos, pos):

        self.region = region
        self.cells = [Cell(self, i) for i in xrange(region.cellsPerCol)] #Please explain this line.
2 Answers
Related