Strange behaviour with type-hinting in PyCharm Code Answer

Say I have a function, do_something:

from typing import *

def do_something(argument: Sequence[Tuple[int, str]]):

Say I also have a dictionary, D, the keys of which are solely ints, and the values of which are solely strings:

D = {1: 'a', 2: 'b', 3: 'c'}

In PyCharm, this will pass the type-checker with flying colours:

    ((1, 'a'), (2, 'b'), (3, 'c'))

But this, according to PyCharm, fails the type-checker, despite being identical in what it produces:


Is this expected behaviour — am I missing something here? — or is this a bug with PyCharm’s type-checker?


This is a bug in PyCharm. There are many similar bugs, e.g. this, this, this.

Related Posts

© No Copyrights, All Questions are retrived from public domain.
Tutorial Guruji