Comment

Comment by libria

I thought the whole single-char-var thing was for very short-lived variables.

I very much prefer

    for c in internalProductCategories
       p = fetchProductsInCategory(c.id)
       m = getAccountManagerName(c.id)
       results.append({categoryName: c.name, products: p, manager: m.name})
to

    for internalProductCategory in internalProductCategories
       products = fetchProductsInCategory(internalProductCategory.id)
       manager = getAccountManagerName(internalProductCategory.id)
       results.append({categoryName: internalProductCategory.name, products: products, manager: manager.name})
They're both clear, neither needs comments, but one is unnecessarily verbose.
parent libria 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton