Change in pysim[master]: utils: Introduce DataObject representation

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon May 3 17:21:51 UTC 2021


fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/24035 )

Change subject: utils: Introduce DataObject representation
......................................................................


Patch Set 3:

(3 comments)

https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py 
File pySim/utils.py:

https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@869 
PS2, Line 869: DataObject
To be fair I also find this part of the documentation extremely confusing :) I would recommend to read this: https://pymotw.com/3/abc/. Sorter and easier to understand.

> Your recent examples look super simlpe in terms of what they do to the code, but I somehow am not certain enough that we're using it like it's documented.

Well, this approach works for me (tm): if you forget to define an abstract method in a child class or define it with a wrong name, you immediately see this error at module load time, rather than a week later at run-time.


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@985 
PS2, Line 985: members=[]
> Ah yes, I read about this some time ago, but forgot it.  […]
The only way seems to be:

  def __init__(self, name, desc = None, members=None):

and then:

  self.members = members if members else []

or even simpler:

  self.members = members or []


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@991 
PS2, Line 991:         for m in self.members:
> but how would I select the m.tag / m.name here?  […]
Ah, sorry for confusing code snippet in my previous comment. Your snippet should work fine.



-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/24035
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iac18e7665481c9323cc7d22a3cd93e3da7869deb
Gerrit-Change-Number: 24035
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Comment-Date: Mon, 03 May 2021 17:21:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge at osmocom.org>
Comment-In-Reply-To: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210503/a7b304e2/attachment.htm>


More information about the gerrit-log mailing list