4 ms·
For everyone saying if you really need these patterns. From the site header > This book is about learning design patterns through the medium of Python language
by shabda 15y ago
For everyone saying if you really need these patterns. From the site header
> This book is about learning design patterns through the medium of Python language.
Its a book about learning the patterns, not idiomatic (or even good) Python. As a example of idiomatic and good python, this book is useless, but if you just want to understand how patterns are used in other languages, this book is not bad.
- anthonyb 15y agoExcept that a lot of patterns tend to be language specific. So while it does teach you patterns, sort of - the patterns here are unlikely to be of any use, since they won't be usable if you're writing Python, and if you're writing Java or C++ you'll need to translate them anyway. For instance, go and have a look at the example code for his command pattern: http://dpip.testingperspective.com/?p=22 http://dpip.testingperspective.com/?p=22 That's not idiomatic anything - in normal Python you'd probably expose a couple of methods on the Light (on/off) and construct a switch to call those. Two classes, duck typed and no need for Command abstract classes and all the extra boilerplate.