pyline
pyline copied to clipboard
ENH,UBY: pyline.main(output=None)
When working with the pyline.pyline.main() function, it's often not necessary to print the results (e.g. when they're appended to to results and the utilized in a downstream function);
there should be a way to not write to stdout or stderr (or a stringio.StringIO (Python 2), io.StringIO).
solution:
With NotImplemented as a default value
- [ ]
def pyline(output=NotImplemented) - [ ]
if not output:- don't write sys.stdout
- [ ]
elif output is NotImplemented:- write to sys.stdout (by default)
workaround:
output=sys.stderroutput=io.StringIO