On Tue, May 19, 2009 at 7:29 AM, Jerry Davis
<jdawgaz@cox.net> wrote:
BTW, can someone tell me why this happens?
$ perl -e 'print "hello world\n"'
hello world
$ python -c 'print "hello world"'
hello world
notice that I DID NOT have to put the \n at then end of the python print
statement? is it something to do with the -c (i.e. smart enough to know it is a
cmd line script, and automatically puts a \n at the end?) or something?
notice what happens when you leave the \n off of the perl script, and add a \n
to the python script.
just curious.
--
[...]
YES, I think it has something to do with the way the syntax works, in Python, for whether one "wants" to start
a new line or not.
Instead of being specifically "indicated", e.g., by having some kind
of \n right where one "wants" to start a new line, it is determined by
whether or not a COMMA is present, after the last item in the list (of
stuff to be printed). (The last item in the list might also be the only
item in the list...) Note that, in a sense the "polarity" is kinda backwards
from the "\n" way of doing things. If the comma is ABSENT, then it
ends the old line (starts a new one).
By the way, in the summer of 2007, I was searching in the on-line
tutorial for Python, to find where it teaches (/slash, documents) about
how this ["comma"] feature works. I finally found it, but NOT by using
the (very limited) indexing feature that is provided by that on-line
tutorial for Python -- rather, I found it by using the "site:..." feature of
doing a google search, and remembering that it can take any leading
substring of the target URL, -- that is, it is NOT [!] limited to a domain
name (as the word 'site:' might suggest).
In fact, I later wrote an e-mail to Alan Dayley (I looked for it today
but I have been unable to find it...!) about using that "site:..." feature of
doing a google search, and remembering that it can take any leading
substring of the target URL -- so it can go beyond (by far) just limiting
itself to the domain name part of the URL.