sacred
sacred copied to clipboard
Suggestions for the capture decorator
I have two suggestions for the capture decorator.
-
The
sacredtool could provide a fail-safe post-definition helper function for decorating. This function could improve could such as this:from xxx import x, y, z ex = sacred.Experiment('foo') x = ex.capture(x) y = ex.capture(y) z = ex.capture(z)The helper function could handle the assignments and even take an array of input functions and
look something likeex.post_capture([x, y, z]). -
Decorating an entire
classwithcaptureshould not only decorate the__init__constructor but all class methods. If one only wants to decorate the constructor this could still be done by explicitly decorating it.
- But unless you want to modify the global scope in some hacky way, you would have to do
x, y, z = ex.post_capture([x, y, z])no? And that you can almost do currently withx, y, z = map(ex.capture, [x, y, z]). So wouldpost_capturereally improve anything? - That usecase makes sense to me. I honestly have never tried capturing a class, but if it would work, I would also expect that behavior. So I'll mark this as a feature request.