__init__
PYL-W02011647 raise ValueError("buffer size too small")
1648
1649 self.buffered = True
1650 self._next = partial(next, self._buffered_generator(size))1651
1652 def __iter__(self) -> "TemplateStream":
1653 return self
1646 if size <= 1:
1647 raise ValueError("buffer size too small")
1648
1649 self.buffered = True1650 self._next = partial(next, self._buffered_generator(size))
1651
1652 def __iter__(self) -> "TemplateStream":
74 return
75 # if marshal_load fails then we need to reload
76 try:
77 self.code = marshal.load(f) 78 except (EOFError, ValueError, TypeError):
79 self.reset()
80 return
Defining an instance attribute outside __init__
affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__
method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None
in the init then call the sub-initialization methods.