Allow integrating output in the source itself
pawamoy opened this issue · 0 comments
pawamoy commented
Is your feature request related to a problem? Please describe.
Following #1 and #2, it would be nice if we could integrate the output of Python code directly within the source itself, most commonly at the end.
Describe the solution you'd like
An integrated-above
(or concat
?) option for the show_source
configuration. Basically: output = code_block("python", source_block + "\n" + output)
.
It would allow this:
def func(name):
"""Return "hello" plus name.
Example:
```pycon exec="yes" show_source="integrated-above" capture="out"
>>> from module import func
>>> print(func("Steve"))
```
"""
return f"Hello {name}!"
Result:
>>> from module import func
>>> print(func("Steve"))
Hello Steve!