[New-bugs-announce] [issue3516] string formatting quirk using %.%

nadav report at bugs.python.org
Thu Aug 7 15:33:06 CEST 2008


New submission from nadav <blop.blopy at gmail.com>:

>>> "%.%s" % ()
'%s'
>>> "%(a).%(b)s" % dict(a=2)
'%(b)s'
>>> "%(a).%(b)s" % dict(a=2, b=3)
'%(b)s'
>>> "%(a).%(b)s" % dict()
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in -toplevel-
    "%(a).%(b)s" % dict()
KeyError: 'a'

this is counter intuitive and cannot be deduced from the documentation.

----------
components: Interpreter Core
messages: 70822
nosy: blop
severity: normal
status: open
title: string formatting quirk using %.%
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3516>
_______________________________________


More information about the New-bugs-announce mailing list