Str.format () para Python 2.6 dá erro onde 2.7 não
Eu tenho um código que funciona bem no Python 2.7.
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import stdout
>>> foo = 'Bar'
>>> numb = 10
>>> stdout.write('{} {}\n'.format(numb, foo))
10 Bar
>>>
Mas no 2.6 eu recebo uma exceção ValueError.
Python 2.6.8 (unknown, Jan 26 2013, 14:35:25)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import stdout
>>> foo = 'Bar'
>>> numb = 10
>>> stdout.write('{} {}\n'.format(numb, foo))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: zero length field name in format
>>>
Ao examinar a documentação (2,6, 2,7), Não vejo menção de mudanças feitas entre as duas versões. O que esta acontecendo aqui?