Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Feb 22, 2022

with self.assertWarns(DeprecationWarning):
compile(test, "<testcase>", "eval")

for num in "0xf", "0o7", "0b1", "9", "0", "1.", "1e3", "1j":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is now a better time to suggest adding an underscore literal 1_000?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many different use cases with underscores: 0x_f, 0x1_f, 0o_7, 0o1_7, 0b_1, 0b1_1, 1., 1_0., 1.0_0, etc. And none of them is related because an underscore cannot ends the numeric literal, and it does not affect interpretation of other characters.

It will increase test coverage.

@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the test_end_of_numerical_literals branch February 25, 2022 08:25
@bedevere-bot
Copy link

GH-31566 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Feb 25, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 25, 2022
…honGH-31494) (cherry picked from commit 98c3bea) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this pull request Feb 25, 2022
…31494) (cherry picked from commit 98c3bea) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

5 participants