python-patterns
python-patterns copied to clipboard
A collection of design patterns/idioms in Python
I think listing anti-patterns with some basic reasoning about "why not" is a good idea. Example - singleton. Although #256 has "won't fix" label - it is in PRs section,...
_3-tier.py_ and _mvc.py_ are almost identical from a high level point of view. The only difference is that in _3-tier.py_ the _logic_ instance and the _ui_ instance may be assigned...
If u can create pdf version so people download it just a suggestion!
…criptor class to decorator method
learning the example [patterns/behavioral/memento.py](https://github.com/faif/python-patterns/blob/master/patterns/behavioral/memento.py#L44). `Transactional` is defined as a descriptor, this looks more complicated ```python class Transactional: def __init__(self, method): self.method = method def __get__(self, obj, T): def transaction(*args, **kwargs):...
This pull request implements the [Servant](https://en.wikipedia.org/wiki/Servant_(design_pattern)) behavioral design pattern. After doing some research about [design patterns](https://en.wikipedia.org/wiki/Software_design_pattern), I found out that this pattern was missing.
In the interest of more flexible testability, several unit tests have been translated from doctest to pytest. Contribution from PyCascades 2024 sprints session.