If you highlight the following code with python.el:<p><pre><code> a = 1
b = 2
</code></pre>
a and b will be highlighted in orange. However, in this code they will not:<p><pre><code> a, b = 1, 2
</code></pre>
I tried to modify python.el so that variables defined by parallel assignment would get highlighted.
I made the following imperfect change to python.el:<p><pre><code> < ;; If parallel assignment is used, up to four variable names are highlighted.
< (,(rx line-start
< (zero-or-one (group (1+ (or word ?_))) (0+ space) "," (0+ space))
< (zero-or-one (group (1+ (or word ?_))) (0+ space) "," (0+ space))
< (zero-or-one (group (1+ (or word ?_))) (0+ space) "," (0+ space))
< (group (1+ (or word ?_))) (0+ space) "=")
< (1 font-lock-variable-name-face) (2 font-lock-variable-name-face)
< (3 font-lock-variable-name-face) (4 font-lock-variable-name-face))
---
> (,(rx line-start (group (1+ (or word ?_))) (0+ space) "=")
> (1 font-lock-variable-name-face))
</code></pre>
The change is imperfect because it only highlights up to 4 variables created by parallel assignment. It does not work for this code:<p><pre><code> a, b, c, d, e = 1, 2, 3, 4, 5
</code></pre>
If anybody is good enough with Emacs Lisp to handle the general case I would be interested to see it.