While reading the option-handling code, I noticed that strax uses a string literal as a sentinel value:
and frequently checks it via identity, e.g.
if self.default is not OMITTED:
...
The usage of identity checks is fragile. We may want to use a more robust approach, like defining a dedicated class, implementing its deterministic hash, and defining how to unpickle the object. For example:
class _OmittedType:
__slots__ = ()
def __repr__(self): return "<OMITTED>"
def __reduce__(self): return "strax.config._get_omitted", ()
def _get_omitted():
return OMITTED
OMITTED = _OmittedType()
And in strax.utils.hashablize:
if obj is OMITTED:
return "<OMITTED>"
Please let me know whether this makes sense. Happy to submit a PR for this.