A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-May/072944.html below:

[Python-Dev] PEP 30XZ: Simplified Parsing

[Python-Dev] PEP 30XZ: Simplified ParsingRaymond Hettinger python at rcn.com
Thu May 3 03:03:39 CEST 2007
[Skip]
> I use it all the time.  For example, to build up (what I consider to be)
>readable SQL queries:
>
> 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 find that style hard to maintain.  What is the advantage over multi-line strings?


 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,))


Raymond
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4