Is there a Python equivalent of the Haskell \'let\' expression that would allow me to write something like:
list2 = [let (name,size)=lookup(productId) in (ba
Only guessing at what Haskell does, here's the alternative. It uses what's known in Python as "list comprehension".
[barcode(productId), metric(size)
for (productId, (name, size)) in [
(productId, lookup(productId)) for productId in list_]
]
You could include the use of lambda:, as others have suggested.