Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-20 Thread Chris Billington
On Wed, Mar 21, 2018 at 10:58 AM, Chris Billington < chrisjbilling...@gmail.com> wrote: > I don't think that's true: > > > > On Wed, Mar 21, 2018 at 10:51 AM, Greg Ewing > wrote: > >> Chris Billington wrote: >> >>> I wonder how mercur

Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-20 Thread Chris Billington
I don't think that's true: On Wed, Mar 21, 2018 at 10:51 AM, Greg Ewing wrote: > Chris Billington wrote: > >> I wonder how mercurial gets around the fact that its own imports might be >> shadowed by whatever's in the current working directory. >> >

Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-20 Thread Chris Billington
On Tue, Mar 20, 2018 at 8:06 PM, Steven D'Aprano wrote: > On Wed, Mar 14, 2018 at 12:09:55PM -0700, Guido van Rossum wrote: > > > Yeah, one should never add a module to sys.path that has a __init__.py > file. > > Should import raise a warning in that case? > > I wouldn't want an outright error. I

Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-14 Thread Chris Billington
06:02PM +1100, Chris Angelico wrote: > > On Wed, Mar 14, 2018 at 4:58 PM, Steven D'Aprano > wrote: > > > On Wed, Mar 14, 2018 at 04:20:20PM +1100, Chris Billington wrote: > > > > > >> Instead, maybe a user should just get a big fat error if they try t

Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-13 Thread Chris Billington
--- File "double_import_denier.py", line 195, in test1() File "double_import_denier.py", line 188, in test1 import linalg ---- On Wed, Mar 14, 2018 at 5:06 PM, Chris Angelico wrote: > On Wed, Mar 14, 2018 at 4:58 PM, Steven D'Aprano > wro

[Python-ideas] Disallow importing the same module under multiple names

2018-03-13 Thread Chris Billington
The Python "double import" problem (discussed here ) leads to subtle bugs in code that change depending on what directory the code was run from. It's hard to think of reasons why importing the same filepath mult