Conversation
zm711
left a comment
There was a problem hiding this comment.
Sounds good to me. I think Heberto started moving some of this over no? Was that PR ever merged....
Co-authored-by: Garcia Samuel <sam.garcia.die@gmail.com>
…e into fix-codecov
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2777 +/- ##
==========================================
- Coverage 70.88% 70.57% -0.32%
==========================================
Files 285 288 +3
Lines 32108 32648 +540
==========================================
+ Hits 22759 23040 +281
- Misses 9349 9608 +259
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Hello, Python only evaluates parms the first time I think the place in our code where we mutate must be the code after: ?? Does that make sense? And do these lines set off any python-anti-pattern alarm bells? |
|
@chrishalcrow you are correct. The following link has a good heuristic to remember why this is the wrong way to go about it: Regarding how to handle it, I have seen three ways to handle this:
In general is is a bad idea to change state or rely on the order of execution as an implicit way of defining the flow. You see the guys from scientific python defending this idea here: That principle is hard to follow though : / |
chrishalcrow
left a comment
There was a problem hiding this comment.
Excellent detective work Alessio! And I think I understand what's going on... 👍
Thanks for the explanation and this link -- that whole site is very informative! |
I prefer the version 2. over the 1. The 3. is the best but only works with tuple that replace list for dict it is more tricky. |
guys this took a lot to debug....
Another reason to advocate not to use mutable objects in functions!!! @samuelgarcia @chrishalcrow @h-mayorquin @zm711 @JoeZiminski
The problem was that the
ComputeTemplates.set_paramstookoperators=["average", "std"]as defaults, and these were propagated to the params dict without copy.The
export_reportsthen calls theplot_unit_templates, which asks for percentiles (which are present there) and somehow these get globally extended to the default kwargs...So no more mutable arguments from now on!!!