abstract base clases Flashcards
1
Q
what issubclass invoke?
A
__subclasscheck__(cls, sub) method of metaclass
2
Q
what isinstance invoke?
A
def __instancecheck__(cls, instance) method of metaclass
3
Q
class method for checking subclass
A
__subclasshook__(sub)
return True False or NontImplemented
4
Q
register class as subclass
A
from abc import ABCMeta
class Text(metaclass=ABCMeta): pass
Text.register(str)
5
Q
abstract base class example
A
from abc import ABC
class MyClass(ABC)
6
Q
decorator for abstractmethods in ABC classes
A
from abc import abstractmethod
7
Q
abstract descriptors must have
A
__isabstractmethod__ property
8
Q
abstractmethod decorator must be …
A
innermost