You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
I think it depends on how the user triggered the automatic fix. If they used a name which would require a from import then use that, otherwise don't. I think adding style options isn't necessary for an MVP and will simply complicate things. I would wait until this goes live to see if people ask for such a feature.
Brett Cannon (@brettcannon) can you provide some examples on when you think we should provide import x.y and when we should provide from x import y ?
and do you think it is something we can change later or must be in at the initial feature implementation?
…
so far, what I have in mind if we do this is
if what we are importing is module, always use
import x.y
(one issue is we might not know "y" is module if "y" is declared from import statement in other module unless the module is already loaded by users and analyzed)
if there is already "from x import z", then do
from x import y, z.
I will do this polishing (using different import style based on context) as separate PR. leave all opinions on this issue so that I can consider those when I implement those improvements
Activity
heejaechang commentedon Oct 24, 2019
tagging Tyreke White (@Anapo14) Steve Dower (@zooba) Brett Cannon (@brettcannon)
heejaechang commentedon Oct 24, 2019
Tyreke White (@Anapo14) Steve Dower (@zooba) Brett Cannon (@brettcannon) is making the feature default to "from x import y" okay?
brettcannon commentedon Oct 24, 2019
I think it depends on how the user triggered the automatic fix. If they used a name which would require a
fromimport then use that, otherwise don't. I think adding style options isn't necessary for an MVP and will simply complicate things. I would wait until this goes live to see if people ask for such a feature.heejaechang commentedon Oct 24, 2019
Brett Cannon (@brettcannon) can you provide some examples on when you think we should provide import x.y and when we should provide from x import y ?
and do you think it is something we can change later or must be in at the initial feature implementation?
…
so far, what I have in mind if we do this is
if what we are importing is module, always use
import x.y
(one issue is we might not know "y" is module if "y" is declared from import statement in other module unless the module is already loaded by users and analyzed)
if there is already "from x import z", then do
from x import y, z.
for other cases, use
from x import y
brettcannon commentedon Oct 25, 2019
Use
from x import ywhen someone typesyand so you have to do afromimport. Ifxis already imported and the user typesx.ythen doimport x.y.It's starting to sound like Tyreke White (@Anapo14) might need to expand/clarify the spec.
Anapo14 commentedon Oct 28, 2019
I agree with Brett here on default import style.
heejaechang commentedon Oct 28, 2019
I will do this polishing (using different import style based on context) as separate PR. leave all opinions on this issue so that I can consider those when I implement those improvements
heejaechang commentedon Oct 28, 2019
tagging Jude Kavalam (@judej) for awareness.