Skip to content

return the just-added tool from addTool

Gerhard Raven requested to merge graven/Gaudi:addTool-return-tool into master

augment addTool to return the tool it just added. This allows one to write:

myToolWithName = myalg.addTool(tool_conf2,"ToolWithName")
myToolWithName.String = "xyz"

instead of

myalg.addTool(tool_conf2,"ToolWithName")
myalg.ToolWithName.String = "xyz"

which requires one to duplicate the "ToolWithName" -- once as string, and once as attribute, because only rarely does anybody use getattr for the 2nd case to avoid the duplication.

Of course, one could write

myalg.addTool(tool_conf2,"ToolWithName", String="xyz")

or even pass in a complete dictionary with **, but the configuration of the tool isn't necessarily complete at the time of creation of its configurable.

Merge request reports

Loading