Skip to content

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

Carreau
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
willingc
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.

5 participants

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant