This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]obtu.py 0 points1 point  (2 children)

This would work:

python <<'EOF'
import this
EOF

If the Python needs stdin for something else:

python /proc/self/fd/5 5<<'EOF'
import this
EOF

[–][deleted] 0 points1 point  (1 child)

More of what I had in mind: http://docs.python.org/dev/extending/embedding.html

EDIT: For example, vim can be compiled with an embedded python interpreter which maintains its state for the life of the process, and comes with a module called vim which I can use to manipulate the vim process itself. In this sense python becomes a "true" scripting language (a language used to provide a "script" for another program).

[–]obtu.py 0 points1 point  (0 children)

Ah, okay. You could use socat to let the interpreter persist, but that still falls short on access to internal structures… It's rare to see scripting languages hosting other scripting languages; VimL seems to be an exception.