Skip to content

[3.6] Cleanup and improve the regex tokenizer example. (GH-10426) #10428

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

Merged
merged 1 commit into from
Nov 9, 2018

Conversation

miss-islington
Copy link
Contributor

  1. Convert weird field name "typ" to the more standard "type".
  2. For the NUMBER type, convert the value to an int() or float().
  3. Simplify group(kind) to the shorter and faster group() call.
  4. Simplify logic go a single if-elif chain to make this easier to extend.
  5. Reorder the tests to match the order the tokens are specified.
    This isn't necessary for correctness but does make the example
    easier to follow.
  6. Move the "column" calculation before the if-elif chain so that
    users have the option of using this value in error messages.
    (cherry picked from commit b83942c)

Co-authored-by: Raymond Hettinger rhettinger@users.noreply.github.com

1) Convert weird field name "typ" to the more standard "type".
2) For the NUMBER type, convert the value to an int() or float().
3) Simplify ``group(kind)`` to the shorter and faster ``group()`` call.
4) Simplify logic go a single if-elif chain to make this easier to extend.
5) Reorder the tests to match the order the tokens are specified.
   This isn't necessary for correctness but does make the example
   easier to follow.
6) Move the "column" calculation before the if-elif chain so that
   users have the option of using this value in error messages.
(cherry picked from commit b83942c)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
@miss-islington
Copy link
Contributor Author

@rhettinger: Status check is done, and it's a success ✅ .

@rhettinger rhettinger merged commit bde5181 into python:3.6 Nov 9, 2018
@bedevere-bot
Copy link

@rhettinger: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington miss-islington deleted the backport-b83942c-3.6 branch November 9, 2018 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants