Skip to content

Odd error message for invalid use of tuple(): expected "Iterable[Never]" #19098

Open
@wyattscarpenter

Description

@wyattscarpenter

tuple(1) is invalid, of course. But what error message does it bring?

main.py:1: error: Argument 1 to "tuple" has incompatible type "int"; expected "Iterable[Never]"  [arg-type]

Well that's odd! Considering that it can take iterables of all sorts of things, and not... impossible things.

In fact, this has to be wrong, because when I make my own function with Iterable[Never] argument, it doesn't like taking iterables of other things

from typing import Iterable, Never

def f(a: Iterable[Never]) -> None:
    pass

f([1,2,3]) # main.py:6: error: Argument 1 to "f" has incompatible type "list[int]"; expected "Iterable[Never]"  [arg-type]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy