Skip to content

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

Merged
willingc merged 5 commits into
python:masterfrom
takluyver:generate_tokens_public
Jun 5, 2018
Merged

bpo-12486: Document tokenize.generate_tokens() as public API#6957
willingc merged 5 commits into
python:masterfrom
takluyver:generate_tokens_public

Conversation

@takluyver

@takluyver takluyver commented May 17, 2018

Copy link
Copy Markdown
Contributor

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

@Carreau Carreau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@takluyver

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Close/reopen, hopefully that will rerun tests.

@takluyver takluyver closed this May 27, 2018
@takluyver takluyver reopened this May 27, 2018

@willingc willingc left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

@Carreau

Carreau commented Jun 5, 2018

Copy link
Copy Markdown
Contributor

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.

5 participants