Skip to content

Use AST token constants from token module. #14701

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sethtroisi
Copy link
Contributor

I'm lukewarm on this change, it's nice for all the constants to use the same namespace but it's ugly to have to change the for token in tokens loops.


After Python 3.7 all tokens are available in both token and tokenize modules

in tokenize's doc

All constants from the token module are also exported from tokenize.

See python/cpython@fc354f0 and https://mail.python.org/pipermail/python-dev/2017-May/148080.html

After Python 3.7 all tokens are available in both `token` and `tokenize`
modules

in tokenize's doc
> All constants from the token module are also exported from tokenize.

See python/cpython@fc354f0
and https://mail.python.org/pipermail/python-dev/2017-May/148080.html
@Carreau
Copy link
Member

Carreau commented Feb 1, 2025

I'm also not a big fan of now having to import both token and tokenize, but I can live with it.
It does seem more cannonical... so why not. Let me sleep on it a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants