[issue3516] string formatting quirk using %.%

2008-08-07 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

I'd rather see it this way: It is a programming error if a format string
contains a reference to a nonexisting dictionary key, no matter what
formatting specifier is used. The implementation is quite consistent here.

--
nosy: +georg.brandl

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3516] string formatting quirk using %.%

2008-08-07 Thread nadav

nadav <[EMAIL PROTECTED]> added the comment:

The main problem with this is that the following code does not make any
sense:
"%(a)%" % dict(a=3)

It has no semantic meaning (take the dictionary paramater a, and do nothing
with it).
It must be a user bug (except in very wierd cases).

I agree that when I consider the implementaion, it makes sense, but as a
python user, this behavior is really non-intuitive.

2008/8/7 Guido van Rossum <[EMAIL PROTECTED]>

>
> Guido van Rossum <[EMAIL PROTECTED]> added the comment:
>
> It's straightforward if you consider the implementation of the
> requirement that %% renders a single percent sign: the second % is
> parsed just like any other formatting code (i, d, f, etc.) and the stuff
> between the first % and the formatting code is treated completely
> uniformly.
>
> --
> nosy: +gvanrossum
> resolution:  -> rejected
> status: open -> closed
>
> ___
> Python tracker <[EMAIL PROTECTED]>
> 
> ___
>

Added file: http://bugs.python.org/file11071/unnamed

___
Python tracker <[EMAIL PROTECTED]>

___The main problem with this is that the following code does not 
make any sense:"%(a)%" % dict(a=3)It has no semantic 
meaning (take the dictionary paramater a, and do nothing with it).
It must be a user bug (except in very wierd cases).I agree that when I 
consider the implementaion, it makes sense, but as a python user, this behavior 
is really non-intuitive.2008/8/7 Guido van 
Rossum [EMAIL 
PROTECTED]>

Guido van Rossum [EMAIL 
PROTECTED]> added the comment:

It's straightforward if you consider the implementation of the
requirement that %% renders a single percent sign: the second % is
parsed just like any other formatting code (i, d, f, etc.) and the stuff
between the first % and the formatting code is treated completely uniformly.

--
nosy: +gvanrossum
resolution:  -> rejected
status: open -> closed

___
Python tracker [EMAIL 
PROTECTED]>
http://bugs.python.org/issue3516>
___

___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3516] string formatting quirk using %.%

2008-08-07 Thread Guido van Rossum

Guido van Rossum <[EMAIL PROTECTED]> added the comment:

It's straightforward if you consider the implementation of the
requirement that %% renders a single percent sign: the second % is
parsed just like any other formatting code (i, d, f, etc.) and the stuff
between the first % and the formatting code is treated completely uniformly.

--
nosy: +gvanrossum
resolution:  -> rejected
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3516] string formatting quirk using %.%

2008-08-07 Thread nadav

New submission from nadav <[EMAIL PROTECTED]>:

>>> "%.%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 "", 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 <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com