[issue18750] '' % [1] doesn't fail

2013-09-01 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Ok. Close as won't fix.
Please reopen if needed.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue18750] '' % [1] doesn't fail

2013-08-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Since people should start to move to str.format instead of % this wart may 
> not be worth fixing.

>>> ''.format_map([1])
''

However I agree that this is not worth fixing.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18750] '' % [1] doesn't fail

2013-08-19 Thread Giacomo Alzetta

Giacomo Alzetta added the comment:

Note that the documentation for formatting with %, found here: 
http://docs.python.org/2/library/stdtypes.html#string-formatting-operations,  
states:

"""
If format requires a single argument, values may be a single non-tuple object. 
[5] Otherwise, values must be a tuple with exactly the number of items 
specified by the format string, or a single mapping object (for example, a 
dictionary)."""

Note how it explicitly states that in an expression: format % value there are 
two different cases:

 - If format contains *exactly one* format specifier, then value can be any 
non-tuple item and it will be formatted as is. Otherwise, value MUST be either 
tuple or a mapping.

In your example '' contains 0 format specifiers, hence you MUST use either a 
tuple or a dict. Any other object triggers "undefined behaviour"(in particular 
depending on whether the object define __geitem__ or not the formatting might 
or might not raise an exception etc.)

AFAIK only few people know this, hence changing the code could potentially 
break a lot of code for apparently no reason.
Since people should start to move to str.format instead of % this wart may not 
be worth fixing.

--
nosy: +bakuriu

___
Python tracker 

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



[issue18750] '' % [1] doesn't fail

2013-08-16 Thread Eric V. Smith

Eric V. Smith added the comment:

The code looks basically the same in 2.7, and there PyMapping_Check looks for 
__getitem__, so maybe issue 5945 is just incorrect in its analysis.

In any event, I'm not sure this is worth fixing. There are lots of little 
corner cases that could be broken.

--

___
Python tracker 

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



[issue18750] '' % [1] doesn't fail

2013-08-16 Thread R. David Murray

R. David Murray added the comment:

Hmm.  The linked issue says the PyMappingCheck behavior is new in Python3, but 
this problem exists in Python2 (back to 2.4 at least) as well.  Perhaps it is a 
different bug in Python2.

--

___
Python tracker 

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



[issue18750] '' % [1] doesn't fail

2013-08-15 Thread Eric V. Smith

Changes by Eric V. Smith :


--
title: '' % [1] doens't fail -> '' % [1] doesn't fail

___
Python tracker 

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