News for hackers. Stuff that matters.
Re:Python Design Patterns (2018) by javcasas on Monday March 14, 2022 @08:54PM (#30680530)
You have a bunch of functions in a list. You choose one of these functions via some criteria, and run it with some provided parameters.

Why it is so different to having a bunch of numbers in a list and choosing one of these numbers via some criteria, then doing one of the allowed operations for that number?

Bear in mind with the function I'm doing exactly the same: do one of the allowed operations for it (invoke the function).

Re:Python Design Patterns (2018) by valenterry on Tuesday March 15, 2022 @04:28AM (#30682890)
Different functions can expect different arguments. For numbers, they are all the same. That's a difference!

Well, you can argue that there are also different numbers and you can do devision only by some of them. But in fact, if you were to separate them and wrap them to do things differently, then this would get closer to the strategy pattern.