> On 26 Jul 2019, at 21:50, Brendan Barnwell <brenb...@brenbarn.net> wrote: > >> On 2019-07-26 11:10, Anders Hovmöller wrote: >> This doesn't really solve the problem imo. Imported symbols shouldn't be i >> portable elsewhere. Not by import * or explicitly. That's the problem. > > I see a fair number of questions about this on StackOverflow and I just > don't understand why people feel it's a problem.
If you see many questions it's by definition a problem. Take the questions seriously. It's Confusing at best. We can fix it. > Who cares what names are accessible in an imported module's namespace? If > you do `import foo` and then `foo.blah` happens to be some oddball name you > didn't expect to be in there, so what? Just don't use it and it doesn't > matter. I see fairly often and it creates weird cases where searching doesn't find stuff because it's imported from the wrong place. It is bad for readability for no good use imo. > As for star-import, it should NEVER be used except in cases where the > module you're star-importing explicitly defines an __all__ and documents that > it's okay to star-import it, in which case the issue is moot since the > __all__ will prevent any unexpected names from being imported. OK. How about enforcing that? This seems to be your suggestion? > The actual problem is that people use star-importing when they shouldn't. That's OPs problem. But that's not mine. I only use import * interactively or in throw away scripts. > I don't think there's any need to change the language to make star imports > easier or more convenient; if anything we should be trying to move away from > their use. I'm fine with keeping star import for interactive use only. *shrug* But this also a long deprecation process. / Anders _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PR6PTKK5F6XA4LX2QUJR5F67QLY6X5TS/ Code of Conduct: http://python.org/psf/codeofconduct/