Singleton-like pattern
Michele Simionato
mis6 at pitt.edu
Sat Aug 2 11:46:32 EDT 2003
Carl Banks <imbosol at aerojockey.com> wrote in message news:<uDAWa.1022$Wt.844 at nwrdny03.gnilink.net>...
> 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.
>
Actually you are right, I remember now that I got problems with
(args,kw) and at the end I used args,tuple(kw.items()). But I was
ensure if this was a good solution.
> > 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)?
I have never used cPickle, I will think about. Thanks,
Michele
More information about the Python-list
mailing list