-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi Item Imports vs Duplicates "froms" #18
Comments
second preferable |
One |
Yes. And we should remind people that you can use parentheses to break them into multiple lines if they exceed the line length (any opinions here? I don't think it's necessary to always use parentheses if it fits on one legal line length). |
I like the first one, but it seems I'm clearly in the minority. For option #2, if we cannot fit the list on one line, which is preferrable: Option a: from a.b.c import ( or Option b: from a.b..c import ( My pref is option (a) |
I like option (a). YAPF does something more like option (a). I usually prefer the YAPF default decisions when I don't have strong opinions. |
I have something like this in the multiline section. The best way to go is to fit everything on one line if possible; otherwise, to put everything on its own line, per 4Catalyzer/flask-resty#136 (comment). So # When everything fits on one line:
(
a, b, c,
)
# Assume these don't fit on one line:
(
long_identifier_1,
long_identifier_2,
long_identifier_3,
)
# But almost never:
(
a,
b, c,
) The latter avoids cruft in diffs from re-wrapping lines when e.g. alphabetizing imports. There are very rare exceptions to the last; e.g. SQLAlchemy has # This:
Index(
'ix_name',
column_1, column_2, column_3,
)
# Is better than:
Index(
'ix_name',
column_1,
column_2,
column_3,
) |
What do people think about these two import styles:
vs.
/CC @nathansilberman @taion @itajaja @nevsan
The text was updated successfully, but these errors were encountered: