Skip to content

Instantly share code, notes, and snippets.

@mouuff
Last active May 31, 2018 12:23
Show Gist options
  • Save mouuff/5c2bed82732f1e6fb37f77edac1fb88c to your computer and use it in GitHub Desktop.
Save mouuff/5c2bed82732f1e6fb37f77edac1fb88c to your computer and use it in GitHub Desktop.
#!/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