Quantcast
Channel: Top-rated recipes
Viewing all articles
Browse latest Browse all 20

Singleton? We don't need no stinkin' singleton: the Borg design pattern (Python)

$
0
0

Python recipe 66531 by Alex Martelli (oop). Revision 2.

The Singleton design pattern (DP) has a catchy name, but the wrong focus -- on identity rather than on state. The Borg design pattern has all instances share state instead, and Python makes it, literally, a snap.


Viewing all articles
Browse latest Browse all 20

Trending Articles