-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/long integer with underscores #923
Feature/long integer with underscores #923
Conversation
@davidism : how would you prefer to handle this? This feature is limited to Python 3..6 and up. Currently it doesn't degrade nicely but I could fix that. Or ignore it. I could make the regex dependent on the python version. I'm open to suggestions but I won't put any more work into this one until I get your feedback. |
We could support the underscore syntax for any version by removing them before calling literal_eval. Seems reasonable enough to do that. |
Good point and should be simple enough to do. |
Also of note, this PR contains the changes to #922 as they are literally on the same lines. |
Finally passes all tests. Let me know if it's acceptable, please. |
I've changed test_float and test_int but I'm thinking we should probably have a test_template that actually tests the regex. |
I'll get to this eventually! I'm just focused on Werkzeug right now. :-) |
add changelog clean up docs parametrize tests explain float regex
0ed6689
to
733851e
Compare
Rebased onto current master + #922 changes. Explained the regex with verbose mode. Allow '_' in any part, which matches Python's grammar. Moved the tests out of filters and into lexer, since that's what this was about, but cleaned up both sets of tests with |
It is now possible to use the '_' character to make long integers and floats more easily understandable by a user.
100_000_000_000 for example, or 100_000_000_000.000_000_001
I don't think this closes any issue but since I had my hands in regex, it was a good timing,