Re: Possible bug in string handling (with kludgy work-around)



--
Note: superfluous indention removed for clarity!
--

On Dec 27, 8:53 am, Dennis Lee Bieber <wlfr...@xxxxxxxxxxxxx> wrote:
You can get by without the backslash in this situation too, by using
triple quoting:

I would not do that because:
1. Because Python already has TWO string literal delimiters (' and ")
2. Because triple quote string literals are SPECIFICALLY created to
solve the "multi-line issue"
3. Because you can confuse the hell out of someone who is reading
Python code and they may miss the true purpose of triple quotes in
Python

But this brings up a very important topic. Why do we even need triple
quote string literals to span multiple lines? Good question, and one i
have never really mused on until now. It's amazing how much BS we just
accept blindly! WE DON'T NEED TRIPLE QUOTE STRINGS! What we need is
single quote strings that span multiple lines and triple quotes then
become superfluous! For the problem of embedding quotes in string
literals, we should be using markup. A SIMPLISTIC MARKUP!

" This is a multi line
string with a single quote --> <SQ>
and a double quote --> <DQ>. Here is an
embedded newline --> <NL>. And a backspace <BS>.

Now we can dispense with all the BS!
"

I find """ clearer, ''' could be a " and '
packed tightly in some fonts, "', whereas """ can only be one construct)

Another reason to ONLY use fixed width font when viewing code! Why
would you use ANY font that would obscure chars SO ubiquitous as " and
'?
.



Relevant Pages

  • Re: Possible bug in string handling (with kludgy work-around)
    ... Because Python already has TWO string literal delimiters ... Because triple quote string literals are SPECIFICALLY created to ...
    (comp.lang.python)
  • Re: Evaluate my first python script, please
    ... So in that sense, the python is "perlesque" ... readable and precompiling the regular expressions and not calculating ... 'Normal' Python string literals use backslashes in escape sequences (eg, ...
    (comp.lang.python)
  • Re: Evaluate my first python script, please
    ... So in that sense, the python is "perlesque" ... Use 'raw' strings for regular expressions. ... 'Normal' Python string literals use backslashes in escape sequences (eg, ...
    (comp.lang.python)
  • Py-dea: Streamline string literals now!
    ... Python string literals, with implications that trickle down to all ... syntax has been flawed, however, we have been totally unaware... ... literals only need one delimiter. ...
    (comp.lang.python)
  • Re: diferences between 22 and python 23
    ... >>Usually major versions of python were courteus with the previous versions... ... but Python used to accept 8-bit characters in the platform's ... and that the default encoding for such conversions would be ASCII ... Python string literals. ...
    (comp.lang.python)