On Tue, Feb 4, 2020 at 3:29 AM Chris Angelico <rosuav@gmail.com> wrote:

Another one to throw into the mix: Trailing underscores, but only if
the expression is incomplete. So in simple cases like this, that means
parenthesizing the number:

P = (29674495668685510550154174642905332730771991_

FWIW, if a multi-line int literal syntax is deemed worthy of having, this syntax really makes me smile as the most obvious about its intent.  I do not think anybody unaware of specific Python syntaxes would misread it.

The requirement of the ()s fits with the general recommendation made to avoid \ by enclosing in ()s.  The question that remains is if the () around every such integer are required, or if this occurring within any existing ()s is sufficient.  ex:


could be semiconfusing.  Though , and _ are visually distinct enough that I think it would stand out.  And disallowing a final trailing _ prevents "_," accidents.  Requiring additional ()s in this case would be fine, but probably isn't worth it.  I expect anyone entering a multi-line super long literal to not be inlining them in common practice and always be assigning them to a useful name for readability's sake.

Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/TTEDIQXY7E5CSL26CTZKCL4KBJJ35ORU/
Code of Conduct: http://python.org/psf/codeofconduct/