summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurie Clark-Michalek <bluepeppers@archlinux.us>2010-11-19 13:23:16 +0000
committerLaurie Clark-Michalek <bluepeppers@archlinux.us>2010-11-19 13:23:16 +0000
commit3e92ed801be456782f0b327d79c7db117a1c40f8 (patch)
treeb2ff0d37d66e34cb37e117fbabef603cd890578b
parenta60f8bed7e85693774951cb4877d793539b6c363 (diff)
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.
-rw-r--r--archey.new7
1 files 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():