Question: I am using Popen to run a command but I don't know how I can write a callback that gets called once the command is finished. Any idea?

Thanks.
Bin

Answer: 
I don't think factories are un-Pythonic. You don't need a whole class, though. One big difference between Java and Python is that in Python you can have code outside of classes. So you might want to create a factory function. Or you can make the factory be a class method on the Person class:

```
class Person:

    name_map = {}

    @classmethod
    def person_from_name(cls, name):
        if name not in cls.name_map:
            cls.name_map[name] = cls(name)
        return cls.name_map[name]

    def __init__(self, name):
        etc...

```

Often the same patterns are at work in Python code as in Java, but we don't make as big a deal of it. In Java, you'd have a whole new class, which would imply a whole new .java file, and you'd need to make it a singleton, etc, etc. Java seems to breed this sort of complexity. A simple class method will do, so just use it.
[Flyweight pattern in Python](http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html#flyweight)? (appears to be broken, [Internet Archive version](http://web.archive.org/web/20090619190842/http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html#flyweight))

Edit: [Another flyweight example in Python](http://push.cx/2006/python-flyweights).