Skip to content

Commit dc63f75

Browse files
committed
Add comment explaining use of __getstate__.
1 parent f8b8610 commit dc63f75

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmdstanpy/stanfit/mcmc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ def __getattr__(self, attr: str) -> np.ndarray:
130130
raise AttributeError(*e.args)
131131

132132
def __getstate__(self) -> dict:
133+
# This function returns the mapping of objects to serialize with pickle.
134+
# See https://docs.python.org/3/library/pickle.html#object.__getstate__
135+
# for details. We call _assemble_draws to ensure posterior samples have
136+
# been loaded prior to serialization.
133137
self._assemble_draws()
134138
return self.__dict__
135139

0 commit comments

Comments
 (0)