[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Antoine Pitrou
On Tue, 26 Jan 2021 10:36:10 +1100 Steven D'Aprano wrote: > On Mon, Jan 25, 2021 at 06:17:09PM +0100, Victor Stinner wrote: > > Hi Bernat, > > > > "stdlib_module_names" was my first idea but it looks too long, so I > > chose "module_names". But someone on Twitter and now you asked me why > > not

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Antoine Pitrou
On Mon, 25 Jan 2021 23:05:07 +0100 Victor Stinner wrote: > > This is a different use case which requires a different solution. > sys.module_names solve some specific use cases (that I listed in my > first email). > > In Python 3.9, you can already check if a module __file__ is in the >

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Victor Stinner
On Tue, Jan 26, 2021 at 12:44 AM Steven D'Aprano wrote: > > On Mon, Jan 25, 2021 at 06:17:09PM +0100, Victor Stinner wrote: > > Hi Bernat, > > > > "stdlib_module_names" was my first idea but it looks too long, so I > > chose "module_names". But someone on Twitter and now you asked me why > > not

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Steve Holden
If the length of the name is any kind of issue, since the stdlib only contains modules (and packages), why not just sys.stdlib_names? On Mon, Jan 25, 2021 at 5:18 PM Victor Stinner wrote: > Hi Bernat, > > "stdlib_module_names" was my first idea but it looks too long, so I > chose

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Steve Dower
On 1/26/2021 8:32 PM, Steve Holden wrote: If the length of the name is any kind of issue, since the stdlib only contains modules (and packages), why not just sys.stdlib_names? And since the modules can vary between platforms and builds, why wouldn't this be sysconfig.stdlib_names rather than

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Brett Cannon
On Tue, Jan 26, 2021 at 1:26 AM Antoine Pitrou wrote: > On Tue, 26 Jan 2021 10:36:10 +1100 > Steven D'Aprano wrote: > > On Mon, Jan 25, 2021 at 06:17:09PM +0100, Victor Stinner wrote: > > > Hi Bernat, > > > > > > "stdlib_module_names" was my first idea but it looks too long, so I > > > chose

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Victor Stinner
On Tue, Jan 26, 2021 at 10:04 PM Steve Dower wrote: > > On 1/26/2021 8:32 PM, Steve Holden wrote: > > If the length of the name is any kind of issue, since the stdlib > > only contains modules (and packages), why not just sys.stdlib_names? > > And since the modules can vary between platforms and

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Chris Jerdonek
On Mon, Jan 25, 2021 at 10:23 PM Random832 wrote: > On Mon, Jan 25, 2021, at 18:44, Chris Jerdonek wrote: > > But to issue a warning when a standard module is being overridden like > > I was suggesting, wouldn’t you also need to know whether the name of > > the module being imported is a

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Steven D'Aprano
On Tue, Jan 26, 2021 at 11:19:13PM +0100, Victor Stinner wrote: > On Tue, Jan 26, 2021 at 10:04 PM Steve Dower wrote: > > > > On 1/26/2021 8:32 PM, Steve Holden wrote: > > > If the length of the name is any kind of issue, since the stdlib > > > only contains modules (and packages), why not just

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Steven D'Aprano
On Tue, Jan 26, 2021 at 12:08:03PM -0800, Brett Cannon wrote: > On Tue, Jan 26, 2021 at 1:26 AM Antoine Pitrou wrote: [...] > > Disagreed. This is niche enough that it warrants a long but explicit > > name, rather than some ambiguous shortcut. > > > > I agree w/ Antoine that a more descriptive

[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021-01-26 Thread Steven D'Aprano
On Tue, Jan 26, 2021 at 10:56:57AM +0100, Victor Stinner wrote: > On Tue, Jan 26, 2021 at 12:44 AM Steven D'Aprano wrote: [...] > > Your first instinct that it is too long is correct. Just call it > > "stdlib" or "stdlib_names". The fact that it is a frozen set of module > > names will be