[ANN] istring interpolated strings release 1.0

Kragen Sitaker kragen at pobox.com
Sun Jan 27 13:04:27 EST 2002


"Steven D. Arnold" <stevena at neosynapse.net> writes:
> Nontheless, you may wish to have other alternatives and I'd like to
> provide them to you if they fit reasonably within the mission of
> istring.  I could add a function like this:
> 
>     AND name = &squote(name)

It looks like you're reinventing Ping's string-interpolation PEP 215
and Itpl module (http://www.lfw.org/python/Itpl.py) with more
complicated syntax, in which the above would be "AND name =
$squote(name)".  Your version is under Yet Another Public License I'd
Have To Waste My Time Reading, while his (worse!) doesn't come with
any license at all.

> On Friday, January 25, 2002, at 9:04:09 AM, Steve Holden wrote:
> SH> Also bear in mind that, which it is necessary to use string interpolation
> SH> for certain portions of statements (such as the table in your example
> SH> above), it is actually _much_ more efficient to use the DB API's parameter
> SH> substitution mechanisms to parameterize query values.
> 
> Excellent point.  Seems like it ought to be easy to extend istring for
> database purposes to do this.

It should be noted that the DB API is more likely to correctly quote
strings like "it's" and "c:\", because correct quoting of those
depends on the particular incompatible extensions to SQL your database
uses.

> SH> Despite these minor misgivings, congratulations on putting something usable
> SH> and worthwhile out for Python users.
> 
> Thanks, I appreciate your feedback.

I agree.




More information about the Python-list mailing list