[Tutor] Making Doubly Linked List with Less Lines of Code.

Danny Yoo dyoo at hashcollision.org
Thu Dec 25 06:17:15 CET 2014


> It seems highly regular; the code here is maintaining a collection of
> row variables.  Because it's so regular, you might consider using a
> list to represent this collection.  Concretely:
>
>     self.rows = [None, None, None, None, None, None, None, None, None, None]


Whoops.  Apologies: I should have named the variable "row" to be
consistent with the rest of the message:

    self.row = [None, None, None, None, None, None, None, None, None, None]

That being said, still easier just to say:

    self.row = [None] * 10


More information about the Tutor mailing list