[Python-Dev] Re: Update PEP 292

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant