Hacker News new | ask | show | jobs
by Joeboy 1589 days ago

    from typing import (
        overload,
        List,
        etc...,
    )
would seem more sensible to me. I know you can make isort do that, I guess maybe not black.
2 comments

My preference is actually for what GP doesn't like; the reason I don't like your suggestion is that:

    from typing import (
        overload,
    )
is silly, but I don't want:

    -from typing import overload
    +from typing import (
    +    overload,
    +    List,
    +)
when all I actually did (semantically) was:

    +    List,
It feels to me like importing names from a module gets you a set of names from that module, so I'm already thinking about it as a collection. It doesn't bother me at all that it's turned into a tuple and spread over multiple lines.
I think I prefer it (first example) to the diff (second), it's just that a singular thing imported is such a common case that three lines for it where it so easily fits on one does seem a bit silly.

Maybe if I were allowed new syntax:

    from typing:
        import overload
        import List
Sorry, that's python-reorder-imports doing the reordering, not black. I just thought it was a related (but separate) project.