namedtuple subclasses should set __slots__=()

This commit is contained in:
Laura Klünder 2017-11-26 18:35:00 +01:00
parent fcae62eb86
commit 587b08a1e4
2 changed files with 3 additions and 0 deletions

View file

@ -21,6 +21,8 @@ class RenderContext(namedtuple('RenderContext', ('width', 'height', 'ctx', 'prog
""" """
A OpenGL Render Context with program and framebuffer. Can only be used by thread that created it. A OpenGL Render Context with program and framebuffer. Can only be used by thread that created it.
""" """
__slots__ = ()
@classmethod @classmethod
def create(cls, width, height): def create(cls, width, height):
ctx = ModernGL.create_standalone_context() ctx = ModernGL.create_standalone_context()

View file

@ -4,6 +4,7 @@ import numpy as np
class Mesh(namedtuple('Mesh', ('top', 'sides', 'bottom'))): class Mesh(namedtuple('Mesh', ('top', 'sides', 'bottom'))):
__slots__ = ()
empty_faces = np.empty((0, 3, 3)).astype(np.int32) empty_faces = np.empty((0, 3, 3)).astype(np.int32)
def tolist(self): def tolist(self):