Skip to content

Instantly share code, notes, and snippets.

Created Oct 4, 2021
What would you like to do?
Python Sample for CR 343
from __future__ import annotations
class Gungan():
__instance = None
# whatever our particular hero does
def __init__(self) -> None:
# whatever config you want to do here
Gungan.__instance = self
# this is a very naive / sloppy singelton, you'll likey want something tighter
def instnace() -> Gungan:
if Gungan.__instance = None:
return Gungan.__instance
Copy link

dominickm commented Oct 4, 2021

This is an example of being able to use type hinting on a return < Python 3.10. In 3.10 the from __future__ will not be required. This requires Python 3.6+

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