In article <mailman.3007.1238515574.11746.python-l...@python.org>, "andrew cooke" <and...@acooke.org> wrote:
> David C. Ullrich wrote: > > In article <tm6dnzxrviq0qfbunz2dnuvz_rmdn...@pdx.net>, > > Scott David Daniels <scott.dani...@acm.org> wrote: [...] > >> > >> class Vector(list): > >> def __add__(self, other): > >> return type(self)(x + y for x, y in zip(self, other)) > > > > Question: I would have thought it would be > > > > return type(self)([x + y for x, y in zip(self, other)]) > > > > What's this thing that looks like a list comprehension but isn't? > > it's a generator expression. > http://docs.python.org/3.0/reference/expressions.html#index-3735 Ah, thanks. I see "dict comprehensions" there too - keen. Sometime I gotta get around to actually learning this 2.x stuff. Thought I had an idea how 1.x worked... > andrew -- David C. Ullrich -- http://mail.python.org/mailman/listinfo/python-list