From d073839d7b75c81dc2223018d647970ca121fe2d Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Mon, 8 Jun 2015 18:48:45 -0700 Subject: [PATCH] Add note to factor protocol docs saying that factors should (ideally) be pickleable --- doc/expert-model-specification.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/expert-model-specification.rst b/doc/expert-model-specification.rst index 5eec536..63b2ba0 100644 --- a/doc/expert-model-specification.rst +++ b/doc/expert-model-specification.rst @@ -197,6 +197,14 @@ The full interface looks like this: ideally be a 1-d or 2-d array or :func:`Categorical` object, but this will be checked and converted as needed. +In addition, factor objects should be pickleable/unpickleable, so as +to allow models containing them to be pickled/unpickled. (Or, if for +some reason your factor objects are *not* safely pickleable, you +should consider giving them a `__getstate__` method which raises an +error, so that any users which attempt to pickle a model containing +your factors will get a clear failure immediately, instead of only +later when they try to unpickle.) + .. warning:: Do not store evaluation-related state in attributes of your factor object! The same factor object may appear in two totally different formulas, or if you have two