Unfindable module: code

Peter Otten __peter__ at web.de
Fri Jul 2 09:00:05 EDT 2021


On 02/07/2021 11:44, Chris Angelico wrote:
> I've just spent half an hour trying to figure out how to mess with the
> Python REPL (specifically, how to implement a line-by-line interactive
> interpreter within a larger app). It's rather hard to find it, but the
> key module is "code".
>> https://docs.python.org/3/library/code.html
>> (How did I end up finding it? By searching the CPython source code for
> "ps1", since interactive mode looks at sys.ps1/sys.ps2 for its
> prompts.)

I would probably have done that too, but for "interpreter".
However, googling for "python interactive interpreter module" has the 
code documentation as its second hit and
https://docs.python.org/3/library/custominterp.html
as its third.
> In the module index, it is listed thus:
>> Custom Python Interpreters
> * code — Interpreter base classes
> * codeop — Compile Python code
>> While this isn't *wrong*, per se, it does hide the fact that this is
> where the REPL can be found. IMO it would be helpful to say that in
> the summary, but I'm not sure what would be good wording.
>> What do people think of calling it "Interactive interpreter and REPL
> implementation"?

To be honest, I think the "unfindable" part are the module names; I 
don't see a big difference between your suggested and the current 
description.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /