summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-06-17 18:29:12 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2015-06-17 18:29:12 +0200
commit4ee7194809d31175074879d1b1a69ef5606eb32c (patch)
treeb5bdc4f8707e3d7729aed5ccb88588b5cebd7049
parent5d1b1930a16ce35eee7c7759ff2add9aa4714d95 (diff)
Add __slots__ to internal classes.
Speeds _Feed creation up a bit during tokenization. Keep public classes slotless for flexibility.
-rw-r--r--kconfiglib.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 27b8ac9..a6d1f5d 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -3070,6 +3070,10 @@ class _Feed(object):
"""Class for working with sequences in a stream-like fashion; handy for
tokens."""
+ # This would be more helpful on the item classes, but would remove some
+ # flexibility
+ __slots__ = ['items', 'length', 'i']
+
def __init__(self, items):
self.items = items
self.length = len(self.items)
@@ -3106,6 +3110,8 @@ class _FileFeed(object):
careful to get the line number right in the presence of continuation
lines."""
+ __slots__ = ['filename', 'lines', 'length', 'linenr']
+
def __init__(self, filename):
self.filename = _clean_up_path(filename)
with open(filename, "r") as f: