Partial string formatting?

Max M maxm at
Tue Jan 21 22:59:07 CET 2003

Gonçalo Rodrigues wrote:
> On Tue, 21 Jan 2003 18:17:49 +0100, Max M <maxm at> wrote:
> This should return instead:
> val1 - 2 - %(key3)s

Then you should just change:

     def __getitem__(self, key):
         return str(self.aDict.get(key, '%%(%s)s' % key))

> As I said, if a priori I know that the formatting code is just s, the
> problem is easily solved. But if I want to be completely general I'm
> basically stuck because the formatting codes can have a bewildering
> array of variations.

Then take care of the type conversion in the adapter object instead.

regards Max M


hilsen/regards Max M
Fremtiden, videnskab, skeptiscisme og transhumanisme

More information about the Python-list mailing list