Making Daniel Brodie's singleton recipe work with keyword arguments


/ Published in: Python
Save to your folder(s)

The ASPN cookbook has many recipes for singletons in Python. So far, this one
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/412551
has been my favourite, because it is so simple and concise. However, I just ran into a brick wall when I tried to use it with a class that can be initialized with keyword arguments. This is my first draft for a solution to this problem. It's quick and dirty; please give it a glance and leave a comment if you find a problem.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.