Change in vdsm[master]: cpuinfo: idea - moving predicates to methods

fromani at redhat.com fromani at redhat.com
Thu Jan 7 14:18:47 UTC 2016


Francesco Romani has posted comments on this change.

Change subject: cpuinfo: idea - moving predicates to methods
......................................................................


Patch Set 3:

(1 comment)

I'm not enthusiast about this. Reasons for my dislike:
- I'm always worried when subclassing native types. This is 95% gut feeling, so let's go ahead
- for all intents and purposes, Architecutre is-a string? I don't see how, and why
- we are using classes with only one methods. My (and IIRC pylint's) minimum threshold is two methods.

Plain functions seems better in this case.

https://gerrit.ovirt.org/#/c/51428/3/lib/vdsm/cpuarch.py
File lib/vdsm/cpuarch.py:

Line 22: 
Line 23: from .config import config
Line 24: 
Line 25: 
Line 26: class _Architecture(str):
works, but I'm always worried about subclassing native types.
OTOH I can pinpoint a specific technical reason, so let's see how this will look like.
Line 27:     def is_ppc(self):
Line 28:         return self in (PPC64, PPC64LE)
Line 29: 
Line 30:     def is_x86(self):


-- 
To view, visit https://gerrit.ovirt.org/51428
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I066575e98ff3778d915255f6c8a68667238fc6fb
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list