[Python-Dev] BDFL-Delegate appointments for several PEPs (original) (raw)
Terry Reedy tjreedy at udel.edu
Sun Mar 24 22:01:14 EDT 2019
- Previous message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Next message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/24/2019 7:00 PM, Cameron Simpson wrote:
On 24Mar2019 17:02, Terry Reedy <tjreedy at udel.edu> wrote:
On 3/24/2019 8:21 AM, Nick Coghlan wrote:
* PEP 499: Binding "-m" executed modules under their module name as well as
_main_
My brief response: +1 unless there is a good reason not. There turn out to be some subtle side effects. The test suite turned up one (easily fixed) in pdb, but there are definitely some more things to investigate. Nick has pointed out pickle and the "python -i" option. I'm digging into these. (Naturally, I have never before used the pdb or pickle modules, or the -i option :-) There have been multiple double module problems reported on python-list and likely stackoverflow. And would there be any impact on circular imports? Well, by binding the -m module to both main and its name as denoted on the command line one circular import is directly short circuited. Aside from the -m module itself, I don't think there should be any other direct effect on circular imports. Did you have a specific scenario in mind?
I was thinking about IDLE and its tangled web of circular inports, but I am now convinced that this change will not affect it. Indeed, idlelib/pyshell.py already implements idea of the proposal, ending with
if name == "main": sys.modules['pyshell'] = sys.modules['main'] main()
(It turns out that this fails for other reasons, which I am looking into. The current recommendation is to start IDLE by runing any of main.py (via python -m idlelib), idle.py, idlew.py, or idle.bat.)
-- Terry Jan Reedy
- Previous message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Next message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]