The part that "\endinput ends the content before the final space" may be a documentation error.
I believe that \endinput by itself does not remove the trailing space by itself, rather it's a side effect of the fact that TeX ignores spaces after control sequences.
E.g. in the following code
\documentclass{article}
\usepackage{pythontex}
\begin{document}
\begin{pycode}
def f():
print(r"1\empty")
\end{pycode}
123\pyc{f()}456
\end{document}
The space is not visible. While in the following code
\documentclass{article}
\usepackage{pythontex}
\begin{document}
\begin{pycode}
def f():
print(r"1\endinput 77")
\end{pycode}
123\pyc{f()}456
\end{document}
The space is visible.
As such, I think it would be better to simply remove the suggestion of using \endinput to remove the trailing space. Using % suffices. (or even \empty / \relax but this one would be confusing)
The part that "
\endinputends the content before the final space" may be a documentation error.I believe that
\endinputby itself does not remove the trailing space by itself, rather it's a side effect of the fact that TeX ignores spaces after control sequences.E.g. in the following code
The space is not visible. While in the following code
The space is visible.
As such, I think it would be better to simply remove the suggestion of using
\endinputto remove the trailing space. Using%suffices. (or even\empty/\relaxbut this one would be confusing)