[Python-Dev] PEP 30XZ: Simplified Parsing

skip at pobox.com skip at pobox.com
Wed May 2 23:23:00 CEST 2007


    Trent> But if you don't want the EOLs? Example from some code of mine:

    Trent>      raise MakeError("extracting '%s' in '%s' did not create the "
    Trent>                      "directory that the Python build will expect: "
    Trent>                      "'%s'" % (src_pkg, dst_dir, dst))

    Trent> I use this kind of thing frequently. Don't know if others
    Trent> consider it bad style.

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 would be disappointed it string literal concatention went away.

Skip


More information about the Python-Dev mailing list