Skip to content

Instantly share code, notes, and snippets.

@mnot
Created March 22, 2017 04:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnot/aec75455057e53f0783531bb21fbe519 to your computer and use it in GitHub Desktop.
Save mnot/aec75455057e53f0783531bb21fbe519 to your computer and use it in GitHub Desktop.
This dies in a fire on 3.5.2, works on 3.6.
#!/usr/bin/env python
from typing import Optional, Type
class Foo(object):
pass
class Bar(Foo):
pass
def test_me() -> Optional[Type[Foo]]:
print("Hi there!")
return Bar
if __name__ == "__main__":
test_me()
@jeamland
Copy link

Also works on 3.5.3:

benno@bjrbsd ~> uname -a
FreeBSD bjrbsd 12.0-CURRENT FreeBSD 12.0-CURRENT #3 r310121: Fri Dec 16 18:50:43 PST 2016     benno@bjrbsd:/src/obj/src/freebsd/sys/GENERIC-NODEBUG  amd64
benno@bjrbsd ~> python3 --version
Python 3.5.3
benno@bjrbsd ~> python3 tt.py
Hi there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment