diff --git a/src/dynamic_graph/script_shortcuts.py b/src/dynamic_graph/script_shortcuts.py index 704773435fa9e05523050ab6e00ff48cbeefd2f0..e7ca93172f28de99aad6bc142de4e4b11f3c38aa 100644 --- a/src/dynamic_graph/script_shortcuts.py +++ b/src/dynamic_graph/script_shortcuts.py @@ -84,3 +84,13 @@ setattr(Entity,'__repr__',Entity.__str__) import sys sys.ps1 = '% ' +# Enable function that can be call without()def optionalparentheses(f): +def optionalparentheses(f): + class decoclass: + def __repr__(self): + res=f() + if isinstance(res,str): return res + else: return '' + def __call__(self,*arg): + return f(*arg) + return decoclass()