SHARE
TWEET

Untitled

a guest Jan 24th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import typing
  2.  
  3. SomeType = typing.NewType('SomeType', str)
  4. OtherType = typing.NewType('OtherType', str)
  5. def fun(s: typing.Type[str]):
  6.    pass
  7.  
  8. fun(SomeType('foo'))
  9.    
  10. mypy_test.py:5: error: Argument 1 to "fun" has incompatible type "SomeType"; expected "Type[str]"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top