Last active
December 20, 2015 11:09
-
-
Save glyphobet/6120800 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Like this: | |
def function( | |
arg, kurz="klein", | |
really_long_argument_name="really long default value", | |
): | |
my_result = do_something( | |
# multiple short arguments on the same line are ok | |
arg, kurz=kurz, | |
really_long_argument_name=do_something_else( | |
one, | |
a_number_that_comes_between_one_and_three, | |
three, # trailing comma, always | |
), # closing parenthesis matches indentation of opening one | |
etc={ | |
# Same for dicts & lists | |
really_long_key="really long value", | |
short="value", | |
}, | |
) | |
# Not like this: | |
def function(arg, kurz="klein", | |
# Indented 13 spaces? Now when I rename function or move it into a class, I have to fix indentation on this line too | |
really_long_argument_name="really long default value"): | |
my_result = do_something(arg, kurz=kurz, | |
# And the lines are still over 79 characters, despite the breaks | |
really_long_argument_name=do_something_else(one, | |
a_number_that_comes_between_one_and_three, | |
three) | |
etc={really_long_key="really long value", # it's hard to re-order items in the dict | |
short="value"}) # and what function call is being terminated with this parenthesis? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment