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

Brett Cannon brett at python.org
Thu Feb 11 13:03:34 EST 2016


On Thu, 11 Feb 2016 at 02:13 Steven D'Aprano <steve at pearwood.info> wrote:

> On Wed, Feb 10, 2016 at 08:41:27PM -0800, Andrew Barnert wrote:
>
> > And honestly, are you really claiming that in your opinion, "123_456_"
> > is worse than all of their other examples, like "1_23__4"?
>
> Yes I am, because 123_456_ looks like you've forgotten to finish typing
> the last group of digits, while 1_23__4 merely looks like you have no
> taste.
>

OK, but the keyword in your sentence is "taste". If we update PEP 8 for our
needs to say "Numerical literals should not have multiple underscores in a
row or have a trailing underscore" then this is taken care of. We get a
dead-simple rule for when underscores can be used, the implementation is
simple, and we get to have more tasteful usage in the stdlib w/o forcing
our tastes upon everyone or complicating the rules or implementation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160211/73e65087/attachment.html>


More information about the Python-Dev mailing list