On Sat, May 11, 2013 at 1:12 PM, Alexandre Fayolle ML <afayolle...@free.fr>wrote:
> > I'll typically use such wrapping on SQL statements: > > cursor.execute('SELECT foo, bar FROM mytable ' > > 'WHERE baz = %(baz)s', > > {'baz': baz}) > > I prefer to use string concatenation using the 'addition' operator, which makes it more explicit: cursor.execute('SELECT foo, bar FROM mytable ' + 'WHERE baz = %(baz)s', {'baz': baz}) At compile time, they are implemented in the same way: >>> dis.dis(lambda: 'a' + 'a') 2 0 LOAD_CONST 2 ('aa') 3 RETURN_VALUE >>> dis.dis(lambda: 'a' 'a') 2 0 LOAD_CONST 1 ('aa') 3 RETURN_VALUE Rigel
_______________________________________________ code-quality mailing list code-quality@python.org http://mail.python.org/mailman/listinfo/code-quality