From 5b97e47ace983c7ceb3627ca6506a38879cddc1e Mon Sep 17 00:00:00 2001 From: Daniel Rasmussen Date: Mon, 3 Aug 2020 15:23:43 -0300 Subject: [PATCH] Improve ambiguous data number warning message It could be non-obvious which input value was triggering this warning. --- nengo_dl/simulator.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nengo_dl/simulator.py b/nengo_dl/simulator.py index 075dac8cc..043e89e9e 100644 --- a/nengo_dl/simulator.py +++ b/nengo_dl/simulator.py @@ -1777,10 +1777,15 @@ def _standardize_data(self, data, objects, broadcast_unary=False): if isinstance(data, (list, tuple)): if len(data) != len(objects): warnings.warn( - "Number of data values (%d) does not match number of %ss (%d); " - "consider using an explicit input dictionary in this " + "Number of elements (%d) in %s does not match number of " + "%ss (%d); consider using an explicit input dictionary in this " "case, so that the assignment of data to objects is unambiguous." - % (len(data), type(objects[0]).__name__, len(objects)) + % ( + len(data), + [type(d).__name__ for d in data], + type(objects[0]).__name__, + len(objects), + ) ) # convert list to named dict