3 ms·
Could you save a line by replacing valueOf(item) with item.value?
by musicale 4y ago
Could you save a line by replacing valueOf(item) with item.value?
- js2 4y agoOP wrote the code as if the list items were dictionaries, so I just made that pythonic. If they are objects whose attributes we care about then we can get rid of the two getters altogether which are mostly there to make the code more legible but also remove duplication. You could also switch them to attrgetters.