wtfpython icon indicating copy to clipboard operation
wtfpython copied to clipboard

New example: typing optional namespace clash

Open etaty opened this issue 5 years ago • 0 comments

The example

from typing import Optional


class S:
    pass


class A:
    S: Optional[S] = S()

    pass


if __name__ == '__main__':
    print("ok?")
TypeError: Optional[t] requires a single type.

https://repl.it/repls/LikableCommonRobodoc

I believe there is a namespace clash between the class variables and the types.

etaty avatar Dec 23 '19 09:12 etaty