Skip to content

Commit 28f0218

Browse files
Add a caveat about -c and the REPL.
1 parent f7661da commit 28f0218

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/howto/multiple-interpreters.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,12 @@ executed with :data:`!__name__` set to something other than
420420
put it in the if block. You will probably only want functions or
421421
classes outside the if block.
422422

423+
Another thing to keep in mind is that, when you run the REPL or run
424+
``python -c ...``, the code that runs is essentially unrecoverable. The
425+
contents of the :mod:`__main__` module cannot be reproduced by executing
426+
a script (or module) file. Consequently, calling a function defined
427+
in :mod:`__main__` in these cases will probably fail.
428+
423429
Calling Methods and Other Objects in an Interpreter
424430
---------------------------------------------------
425431

0 commit comments

Comments
 (0)