[Python-Dev] Re: Update PEP 292 (original) (raw)

Raymond Hettinger python at rcn.com
Mon Aug 23 02:47:14 CEST 2004


... the implementation (patch) I'm going to post will require throw the ValueError for all bad placeholders.

Since you're overriding the mod operator, it may be best to emulate its behavior which is to throw a KeyError:

'%(bingo)s' % {'bongo':'xxx'}

Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- '%(bingo)s' % {'bongo':'xxx'} KeyError: 'bingo'

Raymond



More information about the Python-Dev mailing list