semi-concatenated strings

Grant Griffin Grant_member at newsguy.com
Fri May 31 14:09:58 EDT 2002


In article <mailman.1022861511.22700.python-list at python.org>, Skip says...
>
...
>You can avoid the backslash with a pair of parens.  Recasting my original
>example a little:
...

Thanks, I didn't know that!  (I really gotta take time to read the language
reference some day <wink>.)

>    rows = self.executesql(("select cities.city, state, country"       +
>                            "  from cities, venues, events, addresses" +
>                            "  where cities.city like %s"              +
>                            "    and events.active = 1"                +
>                            "    and venues.address = addresses.id"    +
>                            "    and addresses.city = cities.id"       +
>                            "    and events.venue = venues.id"),
>                           (city,))
>
>I'm surprised nobody commented on the rather weird indentation of the SQL
>statement in my original example.  I use the style in this last example now
>(well, without the extra parens and the plus signs).

I dunno...I don't know anything about SQL, but your code looks sortta Pythonic.

this-whole-nutty-indentation-thing-is-starting-to-catch-on-ly y'rs,

=g2

_________________________________________________________________________

Grant R. Griffin                                           g2 at dspguru.com
Publisher of dspGuru                               http://www.dspguru.com
Iowegian International Corporation                http://www.iowegian.com




More information about the Python-list mailing list