Skip to content

Confusing return type in tokenize.untokenize docs #129020

Closed
@tomasr8

Description

@tomasr8

Documentation

The docs for tokenize.untokenize are somewhat confusing
regarding the return type of the function. The second paragraphs says:

The reconstructed script is returned as a single string.

while the third paragraph clarifies that it can be both str and bytes:

It returns bytes, encoded using the :data:`~token.ENCODING` token, which
is the first token sequence output by :func:`.tokenize`. If there is no
encoding token in the input, it returns a str instead.

I think we should remove the first sentence (The reconstructed script is returned as a single string.)
because it's wrong and if someone is just skimming the docs they might not realize that the full
explanation is only in the next paragraph.

Linked PRs

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dir

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions