PEP8 style for decorators exceeding recommended line length
<p>I have been tinkering with <a href="https://github.com/pyinvoke/invoke" rel="nofollow">Invoke</a>, but I came across something that is quite an odd case that there seems to be no real PEP guideline for it.</p>

<p>Invoke lets you define your own CLI arguments for whatever tasks you define, and you can optionally provide "help notes" to a <code>task</code> decorator. Specific example can be found <a href="http://docs.pyinvoke.org/en/latest/getting_started.html#adding-help-for-parameters" rel="nofollow">here</a>.</p>

<p>If there are more parameters, I could probably do it like this, but it feels kind of weird if there are many tasks. What coding style would you guys do?</p>

<pre><code>help_for_hi = {
    'name1': 'Name of Person 1',
    'name2': 'Name of Person 2',
    'name3': 'Name of Person 3',
}

@task(help=help_for_hi)
def hi(ctx, name1, name2, name3):
    """Say hi to three people."""
    print("Hi %s, %s, and %s!" % (name1, name2, name3))
</code></pre>

<p><strong>UPDATED</strong>  </p>

<p>As requested, this is what 'too long' would probably look like.</p>

<pre><code>@task(help={'name1': 'Name of Person 1', 'name2': 'Name of Person 2', 'name3': 'Name of Person 3'})
def hi(ctx, name1, name2, name3):
    """Say hi to three people."""
    print("Hi %s, %s, and %s!" % (name1, name2, name3))
</code></pre>

<p>You'd just break up the decorator expression into many lines the same way you'd break up any other function call.  One example could be:</p>

<pre><code>@task(help={
    'name1': 'Name of Person 1',
    'name2': 'Name of Person 2',
    'name3': 'Name of Person 3'})
def hi(ctx, name1, name2, name3):
    """Say hi to three people."""
    print("Hi %s, %s, and %s!" % (name1, name2, name3))
</code></pre>

<p>... A codebase that I work on daily has quite a few <code>@mock.patch.object</code> written out this way.</p>

<p>Obviously, breaking out the dictionary into a separate variable can work in this case as you've done in the question (I might actually prefer it assuming that the variable is well named :-).</p>

<pre><code># Nothing wrong with this as far as I can tell ...
help_for_hi = {
    'name1': 'Name of Person 1',
    'name2': 'Name of Person 2',
    'name3': 'Name of Person 3',
}

@task(help=help_for_hi)
def hi(ctx, name1, name2, name3):
    """Say hi to three people."""
    print("Hi %s, %s, and %s!" % (name1, name2, name3))
</code></pre>

python python-decorators pep8 pyinvoke