Skip to content

The example in the doc gets another error in addition to the error which the example wants to show #20612

Description

@hyperkai

*Memo:

  • mypy test.py
  • mypy 1.19.1
  • Python 3.14.0
  • Windows 11

The example in the doc gets another error in addition to the error which the example wants to show as shown below:

def foo(arg: list[int]) -> None:
    print('Items:', ', '.join(arg)) # Anther error

a = []  # Error: Need type annotation for "a"
foo(a)

error: Argument 1 to "join" of "str" has incompatible type "list[int]"; expected "Iterable[str]"

So, it should be as shown below:

def foo(arg: list[int]) -> None:
    print('Items:', ''.join(str(a) for a in arg))

a = []  # Error: Need type annotation for "a"
foo(a)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions