[Python-ideas] Pseudo-package for current directory

Joseph Martinot-Lagarde contrebasse at gmail.com
Wed Mar 9 08:34:09 EST 2016


Niki Spahiev <niki.spahiev at ...> writes:

> 
> On  9.03.2016 12:30, Joseph Martinot-Lagarde wrote:
> >
> > To me the cleanest (from a user point of view) way would be to enable "from
> > . import xxx" in scripts outside packages. When I learned about relative
> > imports I was really surprised by this limitation. If it was possible I'd
> > use it everywhere.
> 
> with python 3.5 import machinery its 3 line hack to fill 
> sys.modules[''].__path__
> 
> Niki

I wasn't aware of this, thanks for the tip. Still, a 3 line hack is not
beginner-friendly, it's still a hack. If it's so simple and useful why not
having it by default ? I see it's been discussed in PEP 338 and 366, but it
would solve the issue discussed here.



More information about the Python-ideas mailing list