From 3e92ed801be456782f0b327d79c7db117a1c40f8 Mon Sep 17 00:00:00 2001 From: Laurie Clark-Michalek Date: Fri, 19 Nov 2010 13:23:16 +0000 Subject: Base the Output class on the list type for a small speed up. Basing a class on a type implemented in C makes the derived class much faster. It's not much use here, but it's a good habbit. --- archey.new | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/archey.new b/archey.new index ec72334..a5d2a4e 100644 --- a/archey.new +++ b/archey.new @@ -134,11 +134,12 @@ class ArcheyException(Exception): pass #---------------Classes---------------# -class Output(): +class Output(list): results = [] def __init__(self): self.distro = self.__detectDistro() + super().__init__() def __detectDistro(self): if os.path.exists('/etc/pacman.conf'): @@ -188,10 +189,10 @@ class Output(): return new_results def append(self, display): - self.results.append('%s%s: %s%s' % (self._color(1), display.key, self._color('Clear'), display.value)) + super().append('%s%s: %s%s' % (self._color(1), display.key, self._color('Clear'), display.value)) def output(self): - results = self._center_results(self.results) + results = self._center_results(self) print(self._get_logo().format(color=self._color(self.distro), results=results)) class BaseDisplay(): -- cgit v1.2.3-54-g00ecf