Attention is currently required from: laforge, neels.
1 comment:
Patchset:
I find it funny that you're saying "normal python" / "plain standard python", as if this was some kind of dialect or a language on top of Python. But the metaclasses are part of the language. PEP 3115 (https://peps.python.org/pep-3115/) dates back to 07-Mar-2007.
As I commented earlier:
IMO, the old approach is much more compact and thus more readable.
so I would vote against this kind of refactoring, sorry.
i don't understand what purpose a meta class serves.
In this particular case it allows assigning class attributes in a compact way.
- fixeria's example shows that the shortest way to achieve class attributes is
You say it's shorter, but looking at this patch I see the modified classes taking nearly twice more lines than the old code. My example simply shows a metaclass `MetaFoo` implementation, that allows to assign class attributes in both ways. But you don't seem to like the idea of mixing up different styles.
- upcoming patches add a lot of class attributes, and i would like to consistently use one way. I chose the "normal python" way, so as a first step, this patch drops the meta class.
Consistency does sound like a solid argument, ok. And indeed, the approach of using metaclasses becomes less readable when you have a lot of attributes. But this can be avoided by creating intermediate classes (like you already do). And by having less attributes, e.g. `len = (min, max)` instead of `min_len` + `max_len`.
Not willing to block you, just sharing my view. Leaving the final decision up to @laforge@osmocom.org.
To view, visit change 39741. To unsubscribe, or for help writing mail filters, visit settings.