<p dir="ltr">On Aug 19, 2015 17:29, "Steven D'Aprano" <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br>
><br>
> On Wed, Aug 19, 2015 at 08:15:05PM -0400, Eric V. Smith wrote:<br>
> > I agree that if it were just about hiding a function call, it<br>
> > wouldn't be interesting at all.<br>
> ><br>
> > But just as:<br>
> > f'My name is {name}'<br>
> ><br>
> > is arguably an improvement over:<br>
> > 'My name is {0}'.format(name)<br>
> ><br>
> > So too would:<br>
> > sql'select {columns} from {table}'<br>
> ><br>
> > be easier to read than:<br>
> > sql.run('select {} from {}', columns, table)<br>
><br>
[...]<br>
> It looks to me that the sql'...' version above is trivially vunerable to<br>
> code injection attacks.</p>
<p dir="ltr">The proposal is more subtle than that: the sql'...' version would expand to something like the sql.run(...) version, i.e. python would be responsible for pulling out the embedded code from the string and evaluating it, and then the sql object would be responsible for safely sticking the values back into the string in an sql-appropriate way or otherwise handling them.</p>
<p dir="ltr">-n</p>