[issue15660] In str.format there is a misleading error message about alignment

2012-08-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

As I read the docs, the error message is correct and this issue is invalid as a 
behavior issue. I read the OP's second message as more or less saying this also.

'='Forces the padding to be placed after the sign (if any) but before the 
digits. This is used for printing fields in the form ‘+00120’. This 
alignment option is only valid for numeric types.

If the width field is preceded by a zero ('0') character, this enables 
zero-padding. This is equivalent to an alignment type of '=' and a fill 
character of '0'.

So :02 is equivalent to :0=2, which is invalid.

 '{:02d}'.format(1)
'01'
works fine.

I decided make this a doc issue and add  for numeric types after this 
enables zero-padding before closing this.

--
assignee:  - docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python, terry.reedy
versions: +Python 2.7, Python 3.3

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



[issue15660] In str.format there is a misleading error message about alignment

2012-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 85cd54b2d3a1 by Terry Jan Reedy in branch '2.7':
Issue 15660: Clarify 0 prefix for width field in str.format doc.
http://hg.python.org/cpython/rev/85cd54b2d3a1

New changeset 6bc14974024f by Terry Jan Reedy in branch '3.2':
Issue 15660: Clarify 0 prefix for width field in str.format doc.
http://hg.python.org/cpython/rev/6bc14974024f

New changeset f181dd088e63 by Terry Jan Reedy in branch 'default':
Merge with 3.2 #15660
http://hg.python.org/cpython/rev/f181dd088e63

--
nosy: +python-dev

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



[issue15660] In str.format there is a misleading error message about alignment

2012-08-17 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
resolution:  - fixed

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



[issue15660] In str.format there is a misleading error message about alignment

2012-08-14 Thread py.user

New submission from py.user:

 '{:02}'.format('a')
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: '=' alignment not allowed in string format specifier



according to http://docs.python.org/py3k/library/string.html#formatspec
the default alignment is '' or ''

--
components: Interpreter Core
messages: 168258
nosy: py.user
priority: normal
severity: normal
status: open
title: In str.format there is a misleading error message about alignment
type: behavior
versions: Python 3.2

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



[issue15660] In str.format there is a misleading error message about alignment

2012-08-14 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +eric.smith, ezio.melotti
stage:  - needs patch
versions: +Python 2.7, Python 3.3, Python 3.4

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



[issue15660] In str.format there is a misleading error message about alignment

2012-08-14 Thread py.user

py.user added the comment:

found a small string in the doc about zero padding, which enables alignment 
equal to =

--
versions:  -Python 2.7, Python 3.3, Python 3.4

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