From dde8ac684456968cdd909d50f947f406772e7415 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 7 Jul 2016 19:36:27 +0200 Subject: [PATCH] Use __slots__ for tab.TabData --- qutebrowser/browser/tab.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/qutebrowser/browser/tab.py b/qutebrowser/browser/tab.py index 0f685e859..a99982bcb 100644 --- a/qutebrowser/browser/tab.py +++ b/qutebrowser/browser/tab.py @@ -74,27 +74,18 @@ class TabData: """A simple namespace with a fixed set of attributes. Attributes: - _initializing: Set when we're currently in __init__. keep_icon: Whether the (e.g. cloned) icon should not be cleared on page load. inspector: The QWebInspector used for this webview. viewing_source: Set if we're currently showing a source view. """ + __slots__ = ['keep_icon', 'viewing_source', 'inspector'] + def __init__(self): - self._initializing = True self.keep_icon = False self.viewing_source = False self.inspector = None - self._initializing = False - - def __setattr__(self, attr, value): - if (attr == '_initializing' or - getattr(self, '_initializing', False) or - hasattr(self, attr)): - return super().__setattr__(attr, value) - msg = "Can't set unknown attribute {!r}".format(attr) - raise AttributeError(msg) class AbstractSearch(QObject):