wtfpython
wtfpython copied to clipboard
New example: typing optional namespace clash
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.