Suggestions could consider standard library module names as well

“Why can’t the suggestion also check for third-party modules in the search path too?”

I will give this a go after we land the first PR adding stdlib modules but I am a bit worried about having to maintain the complexity of that since we need to import pkgutil or similar and a bunch of the Python C-APi to iterate over pkgutil.iter_modules() and extract the names. This also means that we will be doing IO on the except handler, which worries me because this is a tricky place. Also, that list is potentially unbounded so we need to add some limits to control the overhead, which increases the complexity.

I don’t mean this to suggest we won’t be adding it, just to tame expectations around it. Maintaining CPython can be very challenging and we have limited resources so we need to control the complexity. especially when involving critical C code, even if the feature sounds very useful.

For a more complete set of helpers, there is always @aroberge 's fantastic friendly library. We (CPython) need to maintain a balance between being helpful and maintenance, performance, security, correctness … etc so is important to have in mind that sadly some times we need to say “no” to some exciting features.

2 Likes