On Tue, 26 Jan 2021 10:36:10 +1100 Steven D'Aprano <steve@pearwood.info> 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 "stdlib_module_names", so I wrote a PR to rename module_names to sys.stdlib_module_names: https://github.com/python/cpython/pull/24332
At least "stdlib_module_names" better summarizes its definition: "A frozenset of strings containing the names of standard library modules".
Your first instinct that it is too long is correct.
Disagreed. This is niche enough that it warrants a long but explicit name, rather than some ambiguous shortcut.
Just call it "stdlib" or "stdlib_names".
If you call it "stdlib", then you should make it a namedtuple that will expose various information, such as "sys.stdlib.module_names". Regards Antoine.