One trick I often use is launching a Python REPL with a few lines of code already executed, usually to import a library or build an object. Is there an equivalent in ptpython?
After some digging, I believe the best solution is to create a temporary file and either set PYTHONSTARTUP or just pass the file path directly. Not thrilled about handling temp files but it'll get the job done.
One trick I often use is launching a Python REPL with a few lines of code already executed, usually to import a library or build an object. Is there an equivalent in
ptpython
?Here's an example:
This launches a REPL with
foo
already imported, and the lineimport foo
is printed.