Strings: double versus single quotes

DL Neil PythonList at DancesWithMice.info
Sat May 23 16:50:06 EDT 2020


On 24/05/20 8:39 AM, Skip Montanaro wrote:
>>
>>
>> May I ask why not simply like this:
>>
>> stmt = """
>>        select foo from bar
>>          where a = 'bag'
>>            and c = 'dog'
>>        """
> 
> Sorry, I don't recall. I wouldn't be at all surprised that it has something
> to do with Emacs's Python mode behavior. Emacs wouldn't know what to do
> with spaces in the string, but knows where to put string literals within
> the open parens. I'm pretty sure I was doing this before triple quoted
> strings existed.
> 
> Thankfully, I don't need to mess around with SQL anymore. :-)

Awwww. don't be like that - send it all to me, and I'll fix it for you 
(at exorbitant rates, of course)...


The above is valid - the editor has a file in one format/language, and 
is therefore applying 'the wrong rules' when it attempts to make SQL 
look like Python!


The inconvenience (cf "issue") that arises, is that many SQL debuggers 
and error-handlers (etc) will repeat-back the source-code/query 
as-provided. Consequently, those messages are all messed-up with 
extraneous tabs and new-lines, making them difficult to read and debug.
(see also: earlier post mentioning separation of languages/code)
-- 
Regards =dn


More information about the Python-list mailing list