Using pipe in a system call

Cecil Westerhof Cecil at decebal.nl
Sat Oct 10 07:42:15 EDT 2015


On Saturday 10 Oct 2015 09:45 CEST, Frank Millman wrote:

> "Cecil Westerhof" wrote in message
> news:87a8rsnkmw.fsf at Equus.decebal.nl...
>
> This has got nothing to do with your question (which I found
> interesting) but I thought I would mention it.
>
>> export_spreekwoorden is defined as:
>> export_spreekwoorden        = '''
>> SELECT      spreekwoord
>> FROM        spreekwoorden
>> ORDER BY    spreekwoord COLLATE LOCALIZED
>> '''
>
> This works fine, but if anyone examines the resulting sql, it is
> full of extra spaces and newlines.
>
> To avoid this, I have adopted this habit -
>
> export_spreekwoorden = (
> "SELECT spreekwoord "
> "FROM spreekwoorden "
> "ORDER BY spreekwoord COLLATE LOCALIZED"
> )
>
> To my eye, the result is nicer, at virtually no extra effort. Just
> don't forget the trailing space on all but the last line.

Good idea, I will adopt it. With one modification: I also put a
trailing space on the last line. That makes it easier when you extend
the query. ;-)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list