Skip to content

Instantly share code, notes, and snippets.

@macabreb0b
Last active November 10, 2017 01:09
Show Gist options
  • Save macabreb0b/bcb78523801dc00199b250325786fd9d to your computer and use it in GitHub Desktop.
Save macabreb0b/bcb78523801dc00199b250325786fd9d to your computer and use it in GitHub Desktop.
Why you should multi-line parameter arguments

Parameters in "paragraph" style: 🚫 (BAD FOR DIFF)

Old:

def my_method(this, method, takes, a, bunch, 
              of, parameters):

New:

def my_method(this, method, now, takes,
              a, bunch, of, different, parameters):

Diff:

-def my_method(this, method, takes, a, bunch, 
-              of, parameters):
+def my_method(this, method, now, takes,
+              a, bunch, of, different, parameters):

Each parameter on a new line: ✅ (GOOD FOR DIFF)

Old:

def my_method(
    this,
    method,
    takes,
    a,
    bunch,
    of,
    parameters,
):

New:

def my_method(
    this,
    method,
    now,
    takes,
    a,
    bunch,
    of,
    different,
    parameters,
):

Diff:

 def my_method(
     this,
     method,
+    now,
     takes,
     a,
     bunch,
     of,
+    different,
     parameters,
 ):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment