title: Python alignment of assignments (style)
body: <p>I really like following style standards, as those specified in PEP 8. I have a linter that checks it automatically, and definitely my code is much better because of that.</p>
  <p>There is just one point in PEP 8, the E251 &amp; E221 don't feel very good. Coming from a JavaScript background, I used to align the variable assignments as following:</p>
  <pre class="lang-javascript prettyprint-override"><code>var var1        = 1234;
      var2        = 54;
      longer_name = 'hi';
  
  var lol = {
      'that'        : 65,
      'those'       : 87,
      'other_thing' : true
  };
  </code></pre>
  <p>And in my humble opinion, this improves readability dramatically. Problem is, this is dis-recommended by PEP 8. With dictionaries, is not that bad because spaces are allowed after the colon:</p>
  <pre><code>dictionary = {
     'something':        98,
     'some_other_thing': False
  }
  </code></pre>
  <p>I can &quot;live&quot; with variable assignments without alignment, but what I don't like at all is not to be able to pass named arguments in a function call, like this:</p>
  <pre><code>some_func(length=      40,
            weight=      900,
            lol=         'troll',
            useless_var= True,
            intelligence=None)
  </code></pre>
  <p>So, what I end up doing is using a dictionary, as following:</p>
  <pre><code>specs = {
      'length':       40,
      'weight':       900,
      'lol':          'troll',
      'useless_var':  True,
      'intelligence': None
  }
  
  some_func(**specs)
  </code></pre>
  <p>or just simply</p>
  <pre><code>some_func(**{'length':       40,
               'weight':       900,
               'lol':          'troll',
               'useless_var':  True,
               'intelligence': None})
  </code></pre>
  <p>But I have the feeling this work around is just worse than ignoring the PEP 8 E251 / E221.</p>
  <p>What is the best practice?</p>
  <p><strong>EDIT many years later</strong></p>
  <p>Don't align. Sooner or later a new variable that is longer will come and your will have to hit spacebar here and there for a while until everything looks good again. Not worth it.</p>
  <p><strong>EDIT even more years later</strong>
  Just use a code formatter like black and use it as pre-commit and/or your CI. Then forget about this.</p>