[Python-Dev] Re: Update PEP 292

Barry Warsaw barry at python.org
Mon Aug 23 02:50:32 CEST 2004


On Sun, 2004-08-22 at 20:47, Raymond Hettinger wrote:
> > ... 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'

That's a different error, and one that Template still throws, if a
placeholder can't be found in the mapping.  The ValueError is thrown
when an invalid placeholder specification is found.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : [Python-Dev] Re: Update PEP 292

	
  • Next message: [Python-Dev] Re: Update PEP 292
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

  • 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