Last active
May 31, 2018 12:23
-
-
Save mouuff/5c2bed82732f1e6fb37f77edac1fb88c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python3 | |
import six | |
import functools | |
from abc import ABCMeta, ABC, abstractmethod | |
class ATest(ABC): | |
@abstractmethod | |
def get(self): | |
pass | |
class Partial(type): | |
def __call__(cls, *args, **kwargs): | |
return functools.partial(super().__call__, *args, **kwargs) | |
class PartialABC(Partial, ABCMeta): | |
pass | |
class Test(ATest, metaclass=PartialABC): | |
def __init__(self, a, b): | |
print("init %d %d" % (a, b)) | |
def get(self): | |
print("get") | |
partial = Test(1, 2) | |
print("got partial") | |
f = partial() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment