-
-
Save Cjkjvfnby/019311bb75e0fd4cc82614347e07398b to your computer and use it in GitHub Desktop.
Hello world in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def function(): | |
return "Hello" | |
class FunctionMeta(type): | |
def __new__(cls, typename, bases, ns): | |
return lambda: "world" | |
Parent = type.__new__(FunctionMeta, "function", (), {}) | |
function.__mro_entries__ = lambda bases: (Parent,) | |
class Foo(function): # <- WAT? | |
pass | |
print(function(), end=" ") | |
print(Foo()) | |
# See typing.NamedTuple for real-life example |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment