Use __slots__ for class members

Also use the other sort of type hints for instance variables
This commit is contained in:
Jan Petykiewicz 2019-05-17 00:37:56 -07:00
commit 38f64f7c62
11 changed files with 89 additions and 72 deletions

View file

@ -33,10 +33,11 @@ class Pattern:
may reference the same Pattern object.
:var name: An identifier for this object. Not necessarily unique.
"""
shapes = None # type: List[Shape]
labels = None # type: List[Labels]
subpatterns = None # type: List[SubPattern or GridRepetition]
name = None # type: str
__slots__ = ('shapes', 'labels', 'subpatterns', 'name')
shapes: List[Shape]
labels: List[Label]
subpatterns: List[SubPattern or GridRepetition]
name: str
def __init__(self,
shapes: List[Shape]=(),