Hi Richard, and welcome!

My comments are below, interspersed with your comments, which are 
prefixed with ">".

On Mon, Oct 28, 2019 at 12:44:32PM +0100, Richard Vogel wrote:

[...]
> Current state:
> 
>  * Python will search for the first TOP-LEVEL hit when resolving an
>    import statement and search inside there for the remainder part of
>    the import. If it cannot find the symbols it will fail. (Tested on
>    Python 3.8)
> 
> Proposed Change:
> 
>  * If the import fails at some point after finding the first level
>    match: The path is evaluated further until it eventually may be able
>    to resolve the statement completely-
>      o --> Fail later

I'm not exactly sure what your situation is. Perhaps you be a bit more 
specific? But I'm going to try to take a guess:

- your import search path has two or more directories, let's call
  them "a" and "b";

- in "a" you have a module "foo.py":

    # a/foo.py
    spam = 1

- in "b" you have another module also called "foo.py":

    # b/foo.py
    spam = 1
    eggs = 2


If you say "from foo import eggs" the import system finds a/foo.py 
first, and fails since there is no "eggs" name in that module.

You would prefer the import system to continue searching, find b/foo.py, 
and import eggs=2 from that module.

Is my understanding correct?



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

Reply via email to