Singleton-like pattern

Carl Banks imbosol at aerojockey.com
Fri Aug 1 23:06:34 CEST 2003


Michele Simionato wrote:
> About the issue of finding a suitable key, in the same situation I have 
> used the tuple (args,kw) as key.

Surely not?  Perhaps you meant tuple(args,tuple(kw.items())) ?  It gets
rid of the unhashable kw dict.


> But me too I would like to ask if this is a
> good idea. What's the custom solution for getting a good key from
> a dictionary ?

Howabout cPickle.dumps((args,kwargs),1)?


-- 
CARL BANKS




More information about the Python-list mailing list