The util module provides a collection of general purpose methods. Most
importantly it provides the
run() method which is the preferred entry
point of a nutils application, taking care of command line parsing, output dir
creation and initiation of a log file.
compact, lossy string representation of arbitrary object
Method wrapper, converts first positional argument to tuple: tuples/lists are passed on as tuples, other objects are turned into tuple singleton. Return values should match the length of the argument list, and are unpacked if the original argument was not a tuple/list.
>>> class Test: ... @single_or_multiple ... def square(self, args): ... return [v**2 for v in args] ... >>> T = Test() >>> T.square(2) 4 >>> T.square([2,3]) [4, 9]
Parameters: f (method) – Method that expects a tuple as first positional argument, and that returns a list/tuple of the same length. Returns: Return type: Wrapped method.