diff --git a/src/pyhf/workspace.py b/src/pyhf/workspace.py index 1dd3ee47c8..08b285d25e 100644 --- a/src/pyhf/workspace.py +++ b/src/pyhf/workspace.py @@ -18,6 +18,8 @@ from pyhf import exceptions, schema from pyhf.mixins import _ChannelSummaryMixin from pyhf.pdf import Model +import functools +import operator log = logging.getLogger(__name__) @@ -465,8 +467,8 @@ def data(self, model, include_auxdata=True): """ try: - observed_data = sum( - (self.observations[c] for c in model.config.channels), [] + observed_data = functools.reduce( + operator.iadd, (self.observations[c] for c in model.config.channels), [] ) except KeyError: log.error(