Add support for unordered set properties
Change the Python type of std::unordered_set
properties from list
to set
. Parsers only required minor updates and special treatment of the empty set, which can only be represented as set()
in Python.
This will certainly break client code, i.e.
MyAlg.ExtraInputs += ['foo']
will have to be updated to
MyAlg.ExtraInputs.add('foo')
For the moment only std::unordered_set
is mapped to a Python set
. Regular std::set
remains as Python list
to maintain insertion order.
For backwards compatibility, we allow implicit conversion from list
, i.e. the following still works:
MyAlg.ExtraInputs = ['foo'] # implicitly converted to {'foo'}
Apart from aligning the types in C++ and Python, this will also help in improving the performance of the merge
operation in GaudiConfig2 for those properties. Currently, we use the OrderedSetSemantics
to emulate "set" behavior, which is rather slow as it requires iteration over the list of values each time.