diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-10-25 13:08:46 +0000 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-06-11 20:49:46 +0100 |
commit | 41f6604ee4fac1809cee6ade71640d975600812f (patch) | |
tree | 4f7f0669d9fa52fb49ce774f36770823100df884 | |
parent | d4003d1d26b99feffa87c33ca23a63206f38a38d (diff) | |
download | poezio-41f6604ee4fac1809cee6ade71640d975600812f.tar.gz poezio-41f6604ee4fac1809cee6ade71640d975600812f.tar.bz2 poezio-41f6604ee4fac1809cee6ade71640d975600812f.tar.xz poezio-41f6604ee4fac1809cee6ade71640d975600812f.zip |
Replace Line namedtuple with a slotted class.
This will be useful to give Cython a way to optimise the storage in
that class.
-rw-r--r-- | poezio/windows/base_wins.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/poezio/windows/base_wins.py b/poezio/windows/base_wins.py index f22e41d3..7b97086c 100644 --- a/poezio/windows/base_wins.py +++ b/poezio/windows/base_wins.py @@ -28,7 +28,13 @@ allowed_color_digits = ('0', '1', '2', '3', '4', '5', '6', '7') # msg is a reference to the corresponding Message tuple. text_start and # text_end are the position delimiting the text in this line. -Line = collections.namedtuple('Line', 'msg start_pos end_pos prepend') +class Line: + __slots__ = ('msg', 'start_pos', 'end_pos', 'prepend') + def __init__(self, msg, start_pos, end_pos, prepend): + self.msg = msg + self.start_pos = start_pos + self.end_pos = end_pos + self.prepend = prepend LINES_NB_LIMIT = 4096 |