how to keep collection of existing instances and return one on instantiation

marduk usenet at marduk.letterboxes.org
Wed Oct 5 13:08:48 EDT 2005


On Wed, 2005-10-05 at 18:28 +0200, Diez B. Roggisch wrote:
> Use the BORG-pattern. See
> 
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
> 
> Together with your caching, that should do the trick.
> 

I looked at the Borg Pattern, but I don't think it was exactly what I
want.

The Borg patten appears to be if you want multiple instances that point
to the same "data".

What I wanted is multiple calls to create a new object with the same
parameters points to the "original" object instead of creating a new
one.




More information about the Python-list mailing list