News for hackers. Stuff that matters.
Re:Python Design Patterns (2018) by javcasas on Sunday March 13, 2022 @04:48PM (#30665545)
Scrap all the factories. The class name is also a function and a constructor. Just pass it around as parameter, and bypass all the factory stuff.

Use named parameters and bypass the builder pattern.

Store operations in objects/lists. Bypass the strategy patterns with this knowledge. Did you know myobject.mymethod is a function, and you can do x = myobject.mymethod, and then x()? Store methods in lists, pass them as parameters, partially-apply parameters to them.

Generators are more than what the iterator pattern will never be.

There are no comments on this comment yet.