ofproto: _baseattribute can be class attribute
So that it can save memory a bit. Cc: yamamoto@valinux.co.jp Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
4fd61eb8c5
commit
5e703c7f09
@ -58,7 +58,11 @@ def create_list_of_base_attributes(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
ret = f(self, *args, **kwargs)
|
||||
self._base_attributes = set(dir(self))
|
||||
cls = self.__class__
|
||||
# hasattr(cls, '_base_attributes') doesn't work because super class
|
||||
# may already have the attribute.
|
||||
if '_base_attributes' not in cls.__dict__:
|
||||
cls._base_attributes = set(dir(self))
|
||||
return ret
|
||||
return wrapper
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user