[issue3516] string formatting quirk using %.%

2008-08-07 Thread nadav
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] http://bugs.python.org

[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

[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

[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:

string formatting quirk?

2005-05-20 Thread [EMAIL PROTECTED]
Hi, ''%([]) doesn't raise exception but ''%('') does Can anyone explain me why?? rgds Anurag -- http://mail.python.org/mailman/listinfo/python-list

Re: string formatting quirk?

2005-05-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: ''%([]) doesn't raise exception but ''%('') does Can anyone explain me why?? That is a side-effect of duck-typing. The duck-type of an empty list is indistinguishable from that of an empty dictionary. Not testing the exact type here achieves consistency with the