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 9:
(1 comment)
Patchset:
PS6:
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
https://gerrit.osmocom.org/c/pysim/+/39741?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I60ea8fd11fb438ec90ddb08b17b658cbb789c051
Gerrit-Change-Number: 39741
Gerrit-PatchSet: 9
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Sun, 20 Apr 2025 08:06:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>