Jatinderjit Singh
jatinderjit.com
Jatinderjit Singh
@jatinderjit.com
TIL: `sum` function in #Python takes an optional start param. This effectively allows us to add up a sequence of any type, like a list of Vectors.

Among other things, it can be used (in an unoptimised way) to flatten lists!
sum([[1, 2], [3, 4]], start=[]) == [1, 2, 3, 4]
April 20, 2025 at 8:06 AM