On 7/26/2019 4:23 PM, Anders Hovmöller wrote:


On 26 Jul 2019, at 20:58, Eric V. Smith <e...@trueblade.com> wrote:

On 7/26/2019 2:50 PM, Anders Hovmöller wrote:
On 26 Jul 2019, at 20:34, Serhiy Storchaka <storch...@gmail.com> wrote:

26.07.19 21:10, Anders Hovmöller пише:
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 do not think that this is always a problem. It is common to refactor the code 
by defining names in submodules and then importing them in the main module. For 
example, in `json/__init__.py`:

    from .decoder import JSONDecoder, JSONDecodeError
    from .encoder import JSONEncoder

It is possible even to use a star import.

So this change would break much more code.
I believe I covered that in my last email. I'll repeat it here for clarity: if 
you indent to re-export you can do that explicitly:
from foo import bar
bar = bar

I think breaking a whole lot of existing code is a bad idea.

I don't think it's that common that code would break for this. If it does the 
fixed code is very likely better (except in libs where some API is exposed but 
implented in another module).

I personally have dozens of packages where I do "from .submodule import *" in a __init__.py. The stdlib has about 20 such cases. It's a very common pattern when you had a module that became a package and was refactored over time.

And the length of the deprecation period is tweakable. We can set it for 30 
years if we want.

I don't see the point of this change, then. I'm okay with making it a style guide issue, or catch it in a linter.

I'm -1 on this proposal. There's not enough advantage given the churn it would cause.

Eric
_______________________________________________
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/R7FQ2WFF2WDOOGZ7O2RLFYOLPSHEVZLG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to