Python Forum

Full Version: Design pattern in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

What is the use of design patterns in python? Why people go for it?
Many patterns are not used in Python, because of the good features in the language itself.
On the other side, we're using some patterns everyday without knowing it.

In other languages this design patterns are very important. For example in Java you need for everything getters and setters.
In Python we can make properties. The getter and setter pattern is not pythonic.
Example:
The use of design patterns is, that you can name a thing.
The source of design patterns came from an architect.

If you want to read a book about design patterns: https://www.packtpub.com/application-dev...n-patterns
But there is more material available.
As mention bye @DeaD_EyE many patterns get used in Python without of thinking of it or talking about it.
@Brandon Rhodes Python Patterns has good write up about this.
You see stuff like this when talking about verdict/usage of pattern in Python.
Quote:The “Factory Method” pattern is a poor fit for Python.
It was designed for underpowered programming languages where classes and functions can’t be passed as parameters or stored as attributes.
In those languages, the Factory Method serves as an awkward but necessary escape route.
But it’s not a good design for Python applications
By the way, you should subscribe here: https://www.pythonweekly.com/
Issue 342: https://pycoders.com/issues/342

There is one link to: https://python-patterns.guide/