> What I *really* want is to keep a collection of all the Spam instances,
> and if i try to create a new Spam instance with the same contructor
> parameters, then return the existing Spam instance.  I thought new-style
> classes would do it:
<snip>

> So what is the best/preferred way to do this?

Use the BORG-pattern. See


http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531

Together with your caching, that should do the trick.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to