[Python-Dev] PEP 515: Underscores in Numeric Literals (revision 3) (original) (raw)
Steven D'Aprano steve at pearwood.info
Sat Feb 13 09:58:52 EST 2016
- Previous message (by thread): [Python-Dev] PEP 515: Underscores in Numeric Literals (revision 3)
- Next message (by thread): [Python-Dev] PEP 515: Underscores in Numeric Literals (revision 3)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Feb 13, 2016 at 09:48:49AM +0100, Georg Brandl wrote:
Hi all,
after talking to Guido and Serhiy we present the next revision of this PEP. It is a compromise that we are all happy with, and a relatively restricted rule that makes additions to PEP 8 basically unnecessary. I think the discussion has shown that supporting underscores in the from-string constructors is valuable, therefore this is now added to the specification section.
What about Fraction? Currently this is legal:
py> Fraction("1/1000000") Fraction(1, 1000000)
I think the PEP should also support underscores in Fractions:
Fraction("1/1_000_000")
The remaining open question is about the reverse direction: do we want a string formatting modifier that adds underscores as thousands separators?
Yes please.
Open Proposals ==============
It has been proposed [11] to extend the number-to-string formatting language to allow ```` as a thousans separator, where currently only
,
is supported. This could be used to easily generate code with more readable literals.
/s/thousans/thousands/
-- Steve
- Previous message (by thread): [Python-Dev] PEP 515: Underscores in Numeric Literals (revision 3)
- Next message (by thread): [Python-Dev] PEP 515: Underscores in Numeric Literals (revision 3)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]