faif / python-patterns

A collection of design patterns/idioms in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chain pattern is overcomplicated

gyermolenko opened this issue · comments

Hi.
Chain pattern seems overcomplicated (imho).

The file has more or less standard implementation with classes with handlers (client1 = Client()) but also adds comparison with implementation with coroutines (client2 = ClientCoroutine()).
At http://www.dabeaz.com/coroutines/ (docstring description link) I couldn't find this implementation to read more on "why" or what David was trying to illustrate. My assumption is that he concentrated here on generator/coroutine part, not chain pattern itself.

I like simplicity, especially in example code. Therefore I find coroutine implementation unnecessary here. What do you think?

Hi,

I agree with your comments, a simpler example would be easier to understand. Feel free to add one and I'll gladly merge it.

ok, I'll make PR for further discussion