Too much code - slicing

AK andrei.avk at gmail.com
Sat Sep 18 21:58:58 EDT 2010


On 09/18/2010 08:35 PM, Seebs wrote:
> On 2010-09-19, AK<andrei.avk at gmail.com>  wrote:
>> Funny that you should say that, because I thought quite a few times that
>> it would be really awesome if some texts in English had syntax
>> highlighting. Obviously, not Brothers Karamazov, but something like a
>> tutorial, or a manual, or an online article. If key words were
>> highlighted, I'd be able to quickly glance over parts that are not
>> useful to me at the time, and find the interesting bits.
>
> That wouldn't be *syntax* highlighting, that'd be *semantic* highlighting.

In case of programming, the effect is similar. I find that it allows me
to look quickly through code, scanning for something specific, e.g. the
next function, the next if/else block. If I'm looking for a print
statement, for example, I can quickly scan a whole screenful, looking
for a first highlighted long word (all the other highlighted keywords
will usually be if, else, and for). On the other hand, if I know I'm
looking for a variable, my eyes will filter out all the highlighted text
- strings and keywords. English is of course much less formal so you
have to understand the text to do useful highlighting. Anyway, I find it
very odd that anyone would not find it extremely useful (in code)!

>
> Which people often do -- notice that I did it twice in that paragraph.  But
> that's the point -- you need to know what it *means* to make sensible
> decisions about what to highlight.  Syntax highlighting is precisely the
> opposite, highlighting things for reasons that have nothing to do with
> their semantic content.  It distracts from the actual meaning of the
> code.

I'm not always looking for meaning *immediately*. If I know there's a
single print statement in a function, I don't need to understand its
meaning to know that's the one print statement I need. (Or, if there's
two, I might know that I need the first one or at least I'll have 2
lines to look at instead of 75).

>
> In short, syntax highlighting would be like writing:
>
> 	FUNNY *that* _you_ *should* /say/ *that*.
>
>> It'd be like speed reading, except real!
>
> I don't understand this.  So far as I know, the phrase "speed reading"
> refers to various methods of reading much faster than most people read,
> and is real but not exceptionally interesting.

Afaik the idea is that you can read a novel at the speed of half a page
a second or so and understand it to the same extent as people who'd read
at a normal rate. Woody Allen joke: "I learned speed reading and
read War&Peace"; - it involves Russia.

  -ak



More information about the Python-list mailing list