Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: shebang strange thing...

Reply
Thread Tools

Re: shebang strange thing...

 
 
Fredrik Lundh
Guest
Posts: n/a
 
      06-27-2003
Ben Finney wrote:

> CR stands for "carriage return". If you're talking about a print head
> moving across the paper, you're no longer talking about a carriage
> "returning", so the terminology obviously didn't come from electric
> printers.
>
> Carriage Return is a direct reference to the paper carriage on a manual
> typewriter. These predate electric printing machines, and thus the
> terminology was borrowed when teletypes needed control codes to control
> their print head.


let's see: the first typewriters arrived in 1873 or so, and the baudot tele-
printer was patented in 1874. sounds like parallel development to me.

the first electrical teletypes were, as far as I can tell, modified typewriters.

> So, it was teletypes that needlessly preserved the CR and LF as separate
> control operations, due to the typewriter-based thinking of their designers.


I think you're seriously underestimating the effort it took to build an
electromechanical telegraph machine at the very beginning of the 20th
century.

</F>




 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      06-27-2003
"-" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> http://www.velocityreviews.com/forums/(E-Mail Removed) (Bengt Richter) wrote in message

news:<bdcl1d$v43$0@216.39.172.122>...
> > The CR is what you get when you hit the Enter key, so Apple did the most

direct thing
> > in using that key code as an EOL symbol. Perhaps they thought that was

"cleaner" and
> > that they would lead the way to a cleaner standard way of doing things

when they
> > achieved market dominance
> >

>
> I think the terminology is not taken from typewriters, but from some
> old printers where you needed both characters to start a new line.
>

The "old printers" you are thinking of were probably KSR or ASR teletypes,
although similar principles apply to older precursors such as the Creed 5B
teletypewriter (which used a 5-bit code and a shift-locking system to extend
the character set). These did, however, possess a moving print head, while
the "carriage" refers to a platen which moved each time a printable key was
struck. The TAB key moved it until the print position hit a tab stop, and
you could set and clear those stops at will.

> CR moved the print head to the beginning of the line and LF moved the
> paper one line. It can't be compared with a typewriter, where the
> [Enter] key did both operations.


What [Enter] key? In a *proper* typewriter the act of ending one line and
starting another was effected by using the "carriage return lever", which
physically moved the platen back to the left margin, and incidentally also
fed the paper through the platen. Most typewriters could be set to feed one,
one-and-a-half or two lines. Remember, in these devices the printing
position was fixed (no print head) and the paper had to be moved along each
time a character was printed.

> The Microsoft (other operating systems also had similar EOF)


EOF means end of file, usually. You seem to be a bit confused. Don't worry,
me too.

> way is actually the "correct" way, since
> the "cursor" needs to move down one line and start at the beginning.


Ah, so Microsoft are "correct" because they choose a system that corresponds
to a typewriting device you don't understand and are probably too young to
remember. I see.

> The Unix way is of cource more elegant, because you have a digital
> computer and not some mechanical device. It doesn't matter if it's CR
> or LF, because both characters only does half of the operation. Apple
> should have chosen LF to preserve compatibillity.


For that matter it might just as well have been ESC or any other arbitrary
character value - clearly a single character will suffice to delimit a line.
I fail to see why Apple should have chosen LF to preserve compatibility with
Unix if Microsoft are "correct". But then I'm just a crotchety old fartbot,
and you're just a mad surfer.

mess-with-old-farts-at-your-peril-ly y'rs - steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/



 
Reply With Quote
 
 
 
 
Ben Finney
Guest
Posts: n/a
 
      06-27-2003
On Fri, 27 Jun 2003 01:21:20 GMT, Steve Holden wrote:
> "Ben Finney" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.

>
> Although in actual fact the KSR33 teletype did need a fifth of a
> second to guarantee that the print head would have returned to the
> left margin from column 72 haracters was a "feature". Sometimes you
> would (all right, *I* would) depress the two keys in the wrong order,
> and the result was that you would see a single character printed in
> the middle of the new line during the "flyback" period.


Further highlighting the foolishness of keeping them as separate
operations. If they interacted in this non-intuitive and damaging way,
the "go to the start of the next line" should have been a single
transaction for the user, with the implementation deciding how to carry
it out.

--
\ "I spent all my money on a FAX machine. Now I can only FAX |
`\ collect." -- Steven Wright |
_o__) |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      06-27-2003
"Ben Finney" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 26 Jun 2003 12:25:55 -0700, - wrote:
> > I think the terminology is not taken from typewriters, but from some
> > old printers where you needed both characters to start a new line.
> >
> > CR moved the print head to the beginning of the line

>
> CR stands for "carriage return". If you're talking about a print head
> moving across the paper, you're no longer talking about a carriage
> "returning", so the terminology obviously didn't come from electric
> printers.
>
> Carriage Return is a direct reference to the paper carriage on a manual
> typewriter. These predate electric printing machines, and thus the
> terminology was borrowed when teletypes needed control codes to control
> their print head.
>
> On such typewriters, the "line feed" function was also separate; once
> the carriage was returned to the start of the line, one could cause
> the paper to feed up a line at a time to introduce more vertical space;
> this didn't affect the position of the paper carriage, so was
> conceptually a separate operation.
>
> 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.
>


Although in actual fact the KSR33 teletype did need a fifth of a second to
guarantee that the print head would have returned to the left margin from
column 72 haracters was a "feature". Sometimes you would (all right, *I*
would) depress the two keys in the wrong order, and the result was that you
would see a single character printed in the middle of the new line during
the "flyback" period.

mobile-mine-of-useless-information-ly y'rs - steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/



 
Reply With Quote
 
Geoff Gerrietts
Guest
Posts: n/a
 
      06-27-2003
Quoting Ben Finney ((E-Mail Removed)):
> 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

 
Reply With Quote
 
Tim Rowe
Guest
Posts: n/a
 
      06-27-2003
On 27 Jun 2003 09:33:23 +0950, Ben Finney
<(E-Mail Removed)> wrote:

>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.


It wasn't needless. A CR with no LF was often used for overstriking,
as a way of extending the rather limited character set. 'O'
overstruck with '-' would make a passable \Theta, for instance..
 
Reply With Quote
 
-
Guest
Posts: n/a
 
      06-27-2003
"Steve Holden" <(E-Mail Removed)> wrote in message news:<gHMKa.328383$(E-Mail Removed) t>...
> The "old printers" you are thinking of were probably KSR or ASR teletypes,
> although similar principles apply to older precursors such as the Creed 5B
> teletypewriter (which used a 5-bit code and a shift-locking system to extend
> the character set).


Yes, I was thinking about teletypewriter, but couldn't remember the
name.

> EOF means end of file, usually. You seem to be a bit confused. Don't worry,
> me too.
>


Not confused, just a typo

> > way is actually the "correct" way, since
> > the "cursor" needs to move down one line and start at the beginning.

>
> Ah, so Microsoft are "correct" because they choose a system that corresponds
> to a typewriting device you don't understand and are probably too young to
> remember. I see.
>


I was told this by a person I assumed had knowledge of this (he had
used these devices). I should learn to do some research before making
such statements in public.

> > The Unix way is of cource more elegant, because you have a digital
> > computer and not some mechanical device. It doesn't matter if it's CR
> > or LF, because both characters only does half of the operation. Apple
> > should have chosen LF to preserve compatibillity.

>
> For that matter it might just as well have been ESC or any other arbitrary
> character value - clearly a single character will suffice to delimit a line.
> I fail to see why Apple should have chosen LF to preserve compatibility with
> Unix if Microsoft are "correct". But then I'm just a crotchety old fartbot,
> and you're just a mad surfer.
>


I said that using just one character is more elegant, and I think
Apple was right when they chose a single character. I have no real
knowledge of the different line-endings that were used at the time,
but I assume that LF (alone) was more frequently used than CR (alone)
or other characters. If I'm right, the Apple's choice was less
compatible.
 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      06-27-2003
It "-" <(E-Mail Removed)> wrote ...
> "Steve Holden" <(E-Mail Removed)> wrote ...

[...]
> >
> > For that matter it might just as well have been ESC or any other

arbitrary
> > character value - clearly a single character will suffice to delimit a

line.
> > I fail to see why Apple should have chosen LF to preserve compatibility

with
> > Unix if Microsoft are "correct". But then I'm just a crotchety old

fartbot,
> > and you're just a mad surfer.
> >

>
> I said that using just one character is more elegant, and I think
> Apple was right when they chose a single character. I have no real
> knowledge of the different line-endings that were used at the time,
> but I assume that LF (alone) was more frequently used than CR (alone)
> or other characters. If I'm right, the Apple's choice was less
> compatible.


Doesn't really matter - I already told you I'm a crotchety old fartbot

So, FWIW, I agree with you that a single character makes hugely more sense
than CRLF. Apple are well-known for making self-limiting decisions

regards
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/



 
Reply With Quote
 
Van Gale
Guest
Posts: n/a
 
      06-29-2003
Ben Finney wrote:
> I maintain that the CR and LF were needlessly preserved as separate
> operations, with no benefit.


I disagree. IIRC there were plenty of printers where the carriage
return operation took a disproportionately long time, so therefore
backspacing was the prefered method for overstriking, but at the same
time that meant line feeds were a big performance win for smart
applications.

I still have some saved "graphics" output from my NEC Spinwriter
generated by printing a dot "." combined with micro-linefeeds. Ah, the
joys of doing "screenshots" of UCSD Pascal turtlegraphics on an Apple
II... hmmm, think I'm dating myself?

Van

 
Reply With Quote
 
Ben Finney
Guest
Posts: n/a
 
      06-29-2003
On Sun, 29 Jun 2003 11:05:44 GMT, Van Gale wrote:
> Ben Finney wrote:
>> I maintain that the CR and LF were needlessly preserved as separate
>> operations, with no benefit.

>
> I disagree. IIRC there were plenty of printers where the carriage
> return operation took a disproportionately long time, so therefore
> backspacing was the prefered method for overstriking, but at the same
> time that meant line feeds were a big performance win for smart
> applications.


Fair enough then; the operations were kept separate for a reason
justifiable at the time.

Sadly, now we have to live with the legacy of the resulting confusion,
long after those benefits are obsolete.

--
\ "Here is a test to see if your mission on earth is finished. If |
`\ you are alive, it isn't." -- Francis Bacon |
_o__) |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shebang or Hashbang for modules or not? Chris Lasher Python 13 04-23-2007 07:53 PM
Making a shorter shebang veracon Python 5 10-14-2006 04:41 PM
compile shebang into pyc file Joerg Schuster Python 11 04-28-2005 07:46 AM
shebang in cross platform scripts rbt Python 5 04-06-2005 05:33 PM
Optimize flag on shebang line Andres Corrada-Emmanuel Python 0 12-09-2003 07:02 PM



Advertisments