Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-12486: Document tokenize.generate_tokens() as public API #6957

Merged
merged 5 commits into from
Jun 5, 2018

Conversation

takluyver
Copy link
Contributor

@takluyver takluyver commented May 17, 2018

I think discussions of tokenizing unicode have often got caught up in trying to design nicer APIs for it. I am taking the much lazier approach of promoting the existing but undocumented generate_tokens API to a public API.

Why should we do this?

  • generate_tokens() has been there for several releases already (at least since 3.3.0), so we can start using it without having to wait until a new Python version is widespread.
  • Someone (ahem 馃懠 ) might already be using it - IDE tab completion doesn't know that it's not public, and there's no other publicly documented way to tokenize code that's already unicode.
  • Although the naming is not very clear, the interface is a close parallel to tokenize(), so it's easy to understand.
  • We can do this without having to design, implement, review and debug any new interface!

https://bugs.python.org/issue12486

Copy link
Contributor

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

@takluyver
Copy link
Contributor Author

The test failures appear to be unrelated to this pull request (there's a ConnectionRefusedError in the asyncio tests). Could someone prod them to rerun?

@takluyver
Copy link
Contributor Author

Close/reopen, hopefully that will rerun tests.

@takluyver takluyver closed this May 27, 2018
@takluyver takluyver reopened this May 27, 2018
Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks @takluyver

@willingc willingc merged commit c56b17b into python:master Jun 5, 2018
@bedevere-bot
Copy link

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

@Carreau
Copy link
Contributor

Carreau commented Jun 5, 2018

Thanks !

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.

None yet

5 participants