'concatenating''strings'

Terry Reedy tjreedy at udel.edu
Fri Aug 9 01:44:57 CEST 2002


"Will Stuyvesant" <hwlgw at hotmail.com> wrote in message
news:cb035744.0208081004.589ed61 at posting.google.com...
> >>> '1'''
> '1'
> >>> '''3'
> KeyboardInterrupt
> >>> # that did hang with the cursor on the next line so I had to
press
> CTRL-c

Your underlying question seems to be: given the symmetrical definition
of strings (a sequence of chars bounded on each end by the same
delimiter) why aren't mirror image inputs handled in mirror image
fashion.  The answer, which is often assumed more than explained, is
that a programming language interpreter reads and processes input one
char at a time in an asymmetrical order, from left to right.  (People,
on the other hand, learn to see blocks of chars.)  Moreover, it
changes it internal state (what it is willing to see) depending on
what is has already seen to the left.  If processing were switched to
right to left, you would see the interpreter switch responses also.

Terry J. Reedy






More information about the Python-list mailing list