9 Mar
2016
9 Mar
'16
1:34 p.m.
Niki Spahiev
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.