[Python-Dev] PEP 515: Underscores in Numeric Literals

Glenn Linderman v+python at g.nevcal.com
Thu Feb 11 23:28:04 EST 2016


On 2/11/2016 8:22 PM, Andrew Barnert wrote:
> On Thursday, February 11, 2016 8:10 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
>
>> On 2/11/2016 7:56 PM, David Mertz wrote:
>>
>> Great PEP overall. We definitely don't want the restriction to grouping numbers only in threes. South Asian crore use grouping in twos.
>>> https://en.m.wikipedia.org/wiki/Crore
>>>
>> Interesting... 3 digits in the least significant group, and _then_
>     by twos. Wouldn't have predicted that one! Never bumped into that
>     notation before!
>
>
> The first time I used underscore separators in any language, it was a test script for a server that wanted social security numbers as integers instead of strings, like 123_45_6789.[^1]
>
> Which is why I suggested the style guideline should just say "meaningful grouping of digits", rather than try to predict what counts as "meaningful" for every program.
>
>
> [^1] Of course in Python, it's usually trivial to stick a shim in between the database and the model thingy so I could just pass in "123-45-6789", so I don't expect to ever need this specific example.
>

Yes, I had thought of the Social Security Number possibility also, 
although having them as constants in a program seems a bit unusual. Test 
script, fake numbers, yeah, I guess so.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160211/21dbceca/attachment.html>


More information about the Python-Dev mailing list