Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64818

Re: Highlighting program variables instead of keywords?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.060
X-Spam-Evidence '*H*': 0.88; '*S*': 0.00; 'syntax': 0.04; 'differently': 0.07; '2004': 0.09; 'expense': 0.09; 'highlighting': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; "wouldn't": 0.14; 'article:': 0.16; 'benefit.': 0.16; 'block.': 0.16; 'finney': 0.16; 'highlight': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'resource.': 0.16; 'subject:program': 0.16; 'syntactical': 0.16; 'variables,': 0.16; 'code.': 0.18; 'drawing': 0.19; 'seems': 0.21; 'header:User-Agent:1': 0.23; 'aspect': 0.24; 'header:X -Complaints-To:1': 0.27; 'leave': 0.29; 'quickly': 0.29; "doesn't": 0.30; '(like': 0.30; 'ease': 0.30; 'said,': 0.30; 'statement': 0.30; 'strongly': 0.30; "i'm": 0.30; 'code': 0.31; 'too.': 0.31; "d'aprano": 0.31; 'motivation': 0.31; 'once,': 0.31; 'reduced': 0.31; 'steven': 0.31; 'writes:': 0.31; 'anyone': 0.31; 'text': 0.33; 'problem': 0.35; 'beyond': 0.35; 'editor': 0.35; 'one,': 0.35; 'but': 0.35; 'described': 0.36; 'received:com.au': 0.36; 'subject:?': 0.36; 'should': 0.36; 'easily': 0.37; 'attending': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'resource': 0.38; 'rather': 0.38; 'aspects': 0.39; 'structure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'either': 0.39; 'received:org': 0.40; 'read': 0.60; 'most': 0.60; 'first': 0.61; 'kind': 0.63; 'valuable': 0.63; 'our': 0.64; 'more': 0.64; 'different': 0.65; 'skip:\xe2 10': 0.65; 'between': 0.67; 'capable': 0.67; 'benefit': 0.68; 'difficulty': 0.68; '8bit%:43': 0.74; 'obvious': 0.74; 'attention': 0.75; 'convinced,': 0.84; 'distinctive': 0.84; 'obvious.': 0.84; 'received:125': 0.84; '\xe2\x80\x9cwe': 0.84; 'dozen': 0.91; 'faith,': 0.91; 'severe': 0.91; 'convinced': 0.93; 'differences': 0.93; 'reducing': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Highlighting program variables instead of keywords?
Date Mon, 27 Jan 2014 13:08:10 +1100
References <CANc-5UwcZT18RgLqzHq0oMPA4sxfbfu0ZQhGPJBYZ0KEUJ6m2g@mail.gmail.com> <CANc-5UwkLjmwA5LCAKRGjDZaf5EiHXCfU4_Hm2e9yXsDmApR=g@mail.gmail.com> <mailman.6008.1390782718.18130.python-list@python.org> <52e5b66d$0$29999$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host vmx15867.hosting24.com.au
X-Public-Key-ID 0xBD41714B
X-Public-Key-Fingerprint 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-gpg.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:inVi7x7jMJrVb9UEckIkcpZqA8U=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6016.1390788505.18130.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390788506 news.xs4all.nl 2933 [2001:888:2000:d::a6]:54956
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64818

Show key headers only | View raw


Steven D'Aprano <steve+comp.lang.python@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Highlighting program variables instead of keywords? Skip Montanaro <skip@pobox.com> - 2014-01-26 18:31 -0600
  Re: Highlighting program variables instead of keywords? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-27 01:29 +0000
    Re: Highlighting program variables instead of keywords? Chris Angelico <rosuav@gmail.com> - 2014-01-27 12:51 +1100
    Re: Highlighting program variables instead of keywords? Ben Finney <ben+python@benfinney.id.au> - 2014-01-27 13:08 +1100
    Re: Highlighting program variables instead of keywords? Terry Reedy <tjreedy@udel.edu> - 2014-01-27 01:30 -0500

csiph-web