MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1xfxtnx/i_love_python/19rosx33hn1qc/
r/programminghorror • u/nakurtag • Oct 26 '26
81 comments sorted by
View all comments
Show parent comment
35
Unfortunately, I’ve seen monstrosities like this in production in big finance corps. That’s what happens when statisticians are expected to create software.
20 u/marinuso Oct 26 '26 I've seen it used in production code to memoize functions in this manner:def fib(n, cache = {0: 1, 1: 1}): if not n in cache: cache[n] = fib(n-1) + fib(n-2) return cache[n]Except with much more complicated code rather than this simple example. 2 u/bigorangemachine Oct 26 '26 that's actually kinda smart 0 u/bigorangemachine Oct 26 '26 default params is the classic case of IDGAF with code."I don't which array... just add it to an array"
20
I've seen it used in production code to memoize functions in this manner:
def fib(n, cache = {0: 1, 1: 1}): if not n in cache: cache[n] = fib(n-1) + fib(n-2) return cache[n]
Except with much more complicated code rather than this simple example.
2 u/bigorangemachine Oct 26 '26 that's actually kinda smart
2
that's actually kinda smart
0
default params is the classic case of IDGAF with code.
"I don't which array... just add it to an array"
View all comments
Show parent comment
35
u/Double_Cost4865 Oct 26 '26
Unfortunately, I’ve seen monstrosities like this in production in big finance corps. That’s what happens when statisticians are expected to create software.