Attention is currently required from: laforge, neels.
1 comment:
Patchset:
Name: […]
So many letters here... is it a comment by Mychaela? Oh, no, it's Neels!
Just a few cents from me: if properly implemented, a metaclass allows you to pass variables in both ways:
```
# like this
class Foo(metaclass=MetaFoo, a=1, b=2):
''' ... '''
# and like this
# like this
class Foo(metaclass=MetaFoo):
a = 1
b = 2
# or both at the same time
class Foo(metaclass=MetaFoo, a=1):
b = 2
```
This can be achieved as follows:
```
class MetaFoo(abc.ABCMeta):
def __new__(mcs, name, bases, namespace, **kwargs):
x = super().__new__(mcs, name, bases, namespace)
x.a = namespace.get('a', kwargs.get('a', None))
x.b = namespace.get('b', kwargs.get('b', None))
return x
```
A good example is `ApduCommandMeta`.
To view, visit change 39741. To unsubscribe, or for help writing mail filters, visit settings.