From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysvxu-0003Z0-Hm for qemu-devel@nongnu.org; Thu, 14 May 2015 12:26:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ysvxp-0004OC-Jb for qemu-devel@nongnu.org; Thu, 14 May 2015 12:26:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysvxp-0004Nh-CY for qemu-devel@nongnu.org; Thu, 14 May 2015 12:26:25 -0400 Message-ID: <5554CC84.9060003@redhat.com> Date: Thu, 14 May 2015 10:25:40 -0600 From: Eric Blake MIME-Version: 1.0 References: <1431607862-9238-1-git-send-email-eblake@redhat.com> <1431607862-9238-17-git-send-email-eblake@redhat.com> <87d223w37c.fsf@blackfin.pond.sub.org> In-Reply-To: <87d223w37c.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TH9Gsx3u7Ta9cHUqo4aa2VVTkNb57FSCW" Subject: Re: [Qemu-devel] [PATCH v4 16/16] qapi: Prefer '"str" + var' over '"str%s" % var' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, akong@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --TH9Gsx3u7Ta9cHUqo4aa2VVTkNb57FSCW Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/14/2015 10:09 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Use of python's % operator to format strings is fine if there are >> multiple strings or if there is integer formatting going on, but >> when it is just abused for string concatenation, it looks nicer >> to just use the + operator. This is particularly true when the >> value being substituted is at the front of the format string, >> rather than the tail. >=20 > I quite agree in cases such as=20 >=20 > - discriminator_type_name =3D '%sKind' % (name) > + discriminator_type_name =3D name + 'Kind' I could always split this into the obvious cases vs. the questionable ones, if that helps. >=20 > I have doubts in cases such as >=20 > - return "qmp_marshal_output_%s(retval, ret, &local_err);" % c_name(= name) > + return "qmp_marshal_output_" + c_name(name) + "(retval, ret, &loca= l_err);" >=20 > I find the old code makes it easier to grasp the result. Admittedly > subjective. Yeah, that's a judgment call. >=20 >> Update an error message (and testsuite coverage) while at it, since >> concatenating a non-string object does not always produce legible >> results. >=20 > The new expected test output shows improvement. Also might be worth splitting into its own patch, rather than buried in the noise of cleanups. >=20 >> Signed-off-by: Eric Blake >=20 > I'll take 01-15 now, and have a second look at this one later, okay? Yeah, I kind of figured that might happen. Works for me :) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --TH9Gsx3u7Ta9cHUqo4aa2VVTkNb57FSCW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVVMyEAAoJEKeha0olJ0NqXxwH/2paqSg7JNxHBK3UHEtE7gd0 gmmWK5BShdfUHXj/dOU0TmLwocHcG7WFn/AhKHBtzeSa1OxVU628RmDgwHtm8dWp 2yQwCSCYH+1VMynzgkEyzJxATe6ALqrUrfFKAn8U3FQ6YwQyg9hvfZmMA5RbQWGq +npLFuBWVSO7DiNrPy2O6QC25p5w1DYbsMBpcQK7LPZnP//MRRZbYqHmprB895zr q1hEdwmnEdBpD5L/pt8MTBkXeax5gFLfcaiLynJwDIoNb40deH+4ihcZnctR9GjH IOBjdtVEOZKLHtiNCiEfuvULQmS0V7V6W6l+Qu7OW3GPf8TlRPmI1ZB6ttLAr2c= =GiVX -----END PGP SIGNATURE----- --TH9Gsx3u7Ta9cHUqo4aa2VVTkNb57FSCW--