Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > Hmmm, I'm not convinced, but then I wasn't convinced by syntax > highlighting either until I had used it for a while. (I still think > it's a nice-to-have rather than a must-have.)
I wouldn't rate syntax highlighting a must-have. But I do think it's significantly more difficult to work with an editor that doesn't highlight the syntax of the code. > Seems to me that beyond a dozen or so variables, the colours won't be > distinctive enough to get much benefit. A more severe problem with the suggestion is that human cognition is only capable of attending to a limited number of differences at once, and so this kind of attention-drawing is a limited resource. Drawing attention to some aspects is at the expense of reduced attention to other aspects. The significant benefit of syntax highlighting is that it reduces the difficulty to read the text and see what will be obvious to the compiler: the structure of each statement and block. So spending the limited resource of differential attention to colours is valuable to help with this difficult aspect of reading code. So I strongly disagree with the statement “But as it stands, we highlight the obvious (like the word function) and leave most of the content in black.” Once you have attention on it, the word “function” is obvious. But the whole motivation of highlighting syntax using different colours is to get that differential attention in the first place. The difference between tokens *isn't* so obvious when glancing at the code without those colours. That said, the motivation in highlighting different names differently is a good one, too. I would like to have the benefit described in the article: having different names easily distinguished in the code. But I don't think that should come at the expense of significantly reducing the ease of quickly distinguishing the syntactical structure. -- \ “We must find our way to a time when faith, without evidence, | `\ disgraces anyone who would claim it.” —Sam Harris, _The End of | _o__) Faith_, 2004 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list