DEV Community

Discussion on: The art and difficulty of naming in programming

Collapse
 
yannickkiki profile image
yannickkiki • Edited

Nice article, waiting for the part 2!

Just for the record, we could also write this part

if item_map_count.get(item):
    item_map_count[item] += 1
else:
    item_map_count[item] = 1
Enter fullscreen mode Exit fullscreen mode

as this

item_map_count[item] = 1 + item_map_count.get(item, 0)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
fayomihorace profile image
Horace FAYOMI

Beautiful indeed, I like shorthands. Thanks.