Attention is currently required from: laforge, neels.
fixeria has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/pysim/+/39741?usp=email )
Change subject: [1/6] personalization: refactor: drop ClassVarMeta use ......................................................................
Patch Set 6:
(1 comment)
Patchset:
PS6:
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`.