Tim Chase wrote:

> With the single-value tuple, I tend to find the parens make it more
> readable, so I'd go with
> 
> [x*x for (x,) in lst]
 
Hardly ever seen in the wild, but unpacking works with [...], too:

>>> items = zip(range(5))
>>> [x*x for [x] in items]
[0, 1, 4, 9, 16]


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to