shebang strange thing...

Geoff Gerrietts geoff at gerrietts.net
Fri Jun 27 03:51:58 CEST 2003


Quoting Ben Finney (bignose-hates-spam at and-zip-does-too.com.au):
> So, it was teletypes that needlessly preserved the CR and LF as
> separate control operations, due to the typewriter-based thinking of
> their designers.  If they'd been combined into the one operation, we
> would have all the same functionality but none of the confusion over
> line ending controls.

Having CR/LF terminate a line makes reasonable sense for a teletype,
or for a simple printer. Effects such as underline, strikethrough, and
double-print (aka boldface) are accomplished by outputting new
characters on the same line, which can be accomplished by outputting a
CR without a LF.

Similarly, this places double-spacing (two LFs per CR) in the hands of
the controlling machine, rather than the (presumably dumb) slave
device.

One might argue that special control characters would be more
appropriate for these uncommon cases. Then the more common case would
take only a single character, and the special cases two. Most of the
manual typewriters I've used employ a variation on this scheme: a
single "global variable" mechanical switch controls double or single
spacing, and you can overtype only by executing a CR/LF and then
unrolling the LF.

The CR/LF model does have a simpler implementation, though: the
problem of managing linefeeds is passed up to the application. And, as
we know, worse is better (http://www.jwz.org/doc/worse-is-better.html).

--G.

-- 
Geoff Gerrietts             "A little sincerity is a dangerous thing, 
geoff @ gerrietts.net        and a great deal of it is absolutely fatal." 
http://www.gerrietts.net/                           --Oscar Wilde





More information about the Python-list mailing list