Skip to content

reveal_type(x) where x: Tuple[int, ...] doesn't show "..." #9522

Closed
@gvanrossum

Description

@gvanrossum

Bug Report

Using reveal_type() on a variable whose type is a variable-length tuple shows misleading output.

While it's different from the output for a fixed-length tuple (which shows Tuple[builtins.int]), it doesn't clearly indicate that the type is variable-length.

Note that with PEP 585 accepted, eventually we'll have to use builtins.tuple (or, I'd recomment, plain tuple) for both situations.

To Reproduce

from typing import Tuple
a: Tuple[int, ...]
reveal_type(a)

Expected Behavior

t.py:3: note: Revealed type is 'builtins.tuple[builtins.int, ...]'

or

t.py:3: note: Revealed type is 'Tuple[builtins.int, ...]'

Actual Behavior

t.py:3: note: Revealed type is 'builtins.tuple[builtins.int]'

Your Environment

Master or 0.782, no flags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions