Commit 2ef2859
committed
[Python] Deprecate conversion from Python set to RooArgSet
This conversion can lead to subtle problems because Python sets are
unordered, different from C++ initializer lists with the same syntax.
This can lead to confusion that we should prevent.
Example:
```python
import ROOT
x = ROOT.RooRealVar("x", "x", 1.0)
y = ROOT.RooRealVar("y", "y", -1.0)
ROOT.RooArgSet(set([x, y])).Print()
ROOT.RooArgSet(set([y, x])).Print()
```
Gives on my system:
```txt
RooArgSet:: = (x,y)
RooArgSet:: = (x,y) <--- reverse order expected!
```
This is not even deterministic, because Python doesn't guarantee that
a `set` is ordered in any way.
I introduced this 5 years ago in commit c54c324
(PR #8751) whithout thinking
too much about this footgun.1 parent 9916067 commit 2ef2859
3 files changed
Lines changed: 22 additions & 3 deletions
File tree
- README/ReleaseNotes/v642
- bindings/pyroot/pythonizations
- python/ROOT/_pythonization/_roofit
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
129 | 137 | | |
130 | 138 | | |
131 | 139 | | |
| |||
0 commit comments