Python Observer Design Pattern [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question 开发者_运维问答I have two questions:
I'm trying to implement an Observer design pattern in Python. What is the easiest implementation for that?
I need it to observe the status of machines in a render farm that I'm currently building.
Are there any good Python design pattern books out there?
There are already some nice sources of information about design patterns in Python.
Here's an interesting book on Python design patterns.
Last but not least...Alex Martelli gave a very interesting talk regarding this issue for Google Developer Day US.
Edit: After reading that this is a duplicate of another StackOverflow question, I would recommend that everyone read that one as well. There are a lot of useful links and comments there.
You can find a discussion on python design patterns in this previous question.
An implementation of an observer pattern is given here.
Examples of Python implementations of the observer design pattern can be found in the following books:
- Data formatter: "Every time the value of the default formatter is updated, the registered formatters are notified and take action." [Mastering Python Design Patterns, section "The Observer Pattern" subsection "Implementation" / Kindle pos. 2416]
- "(... ) Every observer gets a Unit timestamp an will print it out in either the USA (12 hour) format or the (24 hour) EU format." [Learning Python Design Patterns, section "Observer design pattern" subsection "Implementation in Python" /Kindle pos. 900]
Kasampalis, Sakis | Mastering Python Design Patterns | Packt Publishing Ltd. | 1st | 2015
Zlobin, Gennadiy | Learning Python Design Patterns | Packt Publishing Ltd. | 1st | 2013
By the way: A lot of other references to design pattern implementation examples in Python can be found on eswp3.org.
精彩评论