Skip to Content
0 likes
Python Dictionary Comprehensions: When They Help and When They Hurt Level: Intermediate

A dictionary comprehension builds a dictionary in one line. Good for transforming, filtering and building lookups. Bad for nested logic, side effects and anything that needs error handling. Shorter code is not always better code.

0 likes
map, filter, reduce on a Real List of Orders Level: Intermediate

Five questions a manager would ask about a list of orders, each answered with map, filter, reduce or a plain loop. Real data includes an empty order, and the code has to survive it.

0 likes
Write a Generic identity and map Without Losing Types Level: Intermediate

Turn two any-typed helpers into generic functions and see what the compiler now catches. After this, a typo or a wrong method on the result is a compile error.

0 likes
Record Keys That Match a Real Enum Level: Intermediate

Key a lookup table by an enum or a union of literals so a missing or misspelled key is a compile error. After this, adding a status shows you every table that needs an entry.