2

I have two questions:

  1. 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.

  2. Are there any good Python design pattern books out there?

2
  • 2
    Your question says "Observer" the title says "State". Please pick one design pattern for both question and title. Commented Dec 30, 2009 at 11:27
  • Duplicate: stackoverflow.com/questions/1904351/… Commented Dec 30, 2009 at 11:28

3 Answers 3

6

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.

Sign up to request clarification or add additional context in comments.

Comments

2

You can find a discussion on python design patterns in this previous question.

An implementation of an observer pattern is given here.

Comments

0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.