View source on GitHub |
A decorator indicating an abstract method with an alternative default implementation.
cirq.alternative(
*, requires: str, implementation: T
) -> Callable[[T], T]
This decorator may be used multiple times on the same function to specify multiple alternatives. If multiple alternatives are available, the outermost (lowest line number) alternative is used.
Usage | |
---|---|
class Parent(metaclass=ABCMetaImplementAnyOneOf):
def _default_do_a_using_b(self, ...):
...
def _default_do_a_using_c(self, ...):
...
class Child(Parent): def do_b(self): ... child = Child() child.do_a(...) |