[Python-Dev] typo in 8.1.3.1. Format Specification Mini-Language?

2009-05-07 Thread Neal Becker
"format_spec ::=  [[fill]align][sign][#][0][width][.precision][type]"
"The precision is ignored for integer values."

In [36]: '%3x' % 10
Out[36]: '  a'

In [37]: '%.3x' % 10
Out[37]: '00a'

Apparently, precision is _not_ ignored? 


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] typo in 8.1.3.1. Format Specification Mini-Language?

2009-05-07 Thread Eric Smith

Neal Becker wrote:

"format_spec ::=  [[fill]align][sign][#][0][width][.precision][type]"
"The precision is ignored for integer values."

In [36]: '%3x' % 10
Out[36]: '  a'

In [37]: '%.3x' % 10
Out[37]: '00a'

Apparently, precision is _not_ ignored? 


That section is talking about this:

>>> format(10, '.3x')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Precision not allowed in integer format specifier
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] typo in 8.1.3.1. Format Specification Mini-Language?

2009-05-07 Thread Eric Smith

Eric Smith wrote:

Neal Becker wrote:

"format_spec ::=  [[fill]align][sign][#][0][width][.precision][type]"
"The precision is ignored for integer values."

In [36]: '%3x' % 10
Out[36]: '  a'

In [37]: '%.3x' % 10
Out[37]: '00a'

Apparently, precision is _not_ ignored? 


That section is talking about this:

 >>> format(10, '.3x')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Precision not allowed in integer format specifier


So I guess it shouldn't say "is ignored", it should be "is not allowed".
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] typo in 8.1.3.1. Format Specification Mini-Language?

2009-05-07 Thread Terry Reedy

Neal Becker wrote:

"format_spec ::=  [[fill]align][sign][#][0][width][.precision][type]"
"The precision is ignored for integer values."

In [36]: '%3x' % 10
Out[36]: '  a'

In [37]: '%.3x' % 10
Out[37]: '00a'

Apparently, precision is _not_ ignored? 


Apparent typo reports should go to the tracker, along with version 
information.  In this case, the Format Specification Mini-Language is 
for the new str.format() and format() facilities, not for % formatting, 
which is described in Old String Formatting Operations.  Ironically, you 
report does point to a doc problem: precision is actually not allowed 
for integer types.


3.0.1
>> format(10, '3x')
'  a'
>>> format(10, '.3x')
Traceback (most recent call last):
  File "", line 1, in 
format(10, '.3x')
ValueError: Precision not allowed in integer format specifier

>>> '{0:3x}'.format(10)
'  a'
>>> '{0:.3x}'.format(10)
Traceback (most recent call last):
  File "", line 1, in 
'{0:.3x}'.format(10)
ValueError: Precision not allowed in integer format specifier

http://bugs.python.org/issue5963

Terry Jan Reedy

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] typo in 8.1.3.1. Format Specification Mini-Language?

2009-05-07 Thread Terry Reedy

Eric Smith wrote:

Eric Smith wrote:

Neal Becker wrote:

"format_spec ::=  [[fill]align][sign][#][0][width][.precision][type]"
"The precision is ignored for integer values."

In [36]: '%3x' % 10
Out[36]: '  a'

In [37]: '%.3x' % 10
Out[37]: '00a'

Apparently, precision is _not_ ignored? 


That section is talking about this:

 >>> format(10, '.3x')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Precision not allowed in integer format specifier


So I guess it shouldn't say "is ignored", it should be "is not allowed".


My exact suggestion in http://bugs.python.org/issue5963

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com