[issue39568] FORMATTING grouping_option ValueError: Cannot specify ', ' with ...

2020-02-06 Thread Another One


New submission from Another One :

Example for binary representation:

>>> x = 123456
>>> print("{:,b}".format(x))
Traceback (most recent call last):
  File "", line 1, in 
print("{:,b}".format(x))
ValueError: Cannot specify ',' with 'b'.

Why? Comma work only with decimals?

But '_' groups delimiter properly work with any integer representation 
including decimals, hexadecimals, binaries, octals, etc..

--
messages: 361480
nosy: Another One
priority: normal
severity: normal
status: open
title: FORMATTING grouping_option ValueError: Cannot specify ',' with ...
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue39568>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39568] FORMATTING grouping_option ValueError: Cannot specify ', ' with ...

2020-02-06 Thread Another One


Another One  added the comment:

Not for 3 bits, just for 4 bits, like this:
>>> print("{:_b}".format(123456))
1_1110_0010_0100_

And as I already said: "But '_' groups delimiter properly work with any integer 
representation including decimals, hexadecimals, binaries, octals, etc.." Not 
only for binaries.
Why comma delimiter is not?
Logic must be the same. Simple use the one procedure for '_' delimiter with 
permit comma as parameter, instead of two different logic.

--

___
Python tracker 
<https://bugs.python.org/issue39568>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com