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_
        79985304335099507553127683875317177019959423_
        8596428121188033664754218345562493168782883)


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:

method.call(123_
  456,
  786_
  9)

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.

-gps
 
ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.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/