2 ms·
The advice being given is more applicable to problems which have some real state inherent in the problem, e.g. network connections, UI state or databases. In n
by yetanotherphd 13y ago
The advice being given is more applicable to problems which have some real state inherent in the problem, e.g. network connections, UI state or databases.
In numerical programming, state is less obvious because it depends on how you do the calculation.
In numerical programming, I tend to use a functional style that makes use of objects. E.g. instead of
y = f(params, x)
I would write
y = my_object.f(x)
where my_object encapsulates params. This makes sense as the only function that needs to access params is f. On the other hand Python has no private members anyway so I would probably use the first way for Python anyway.