From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysvhm-0005lj-SL for qemu-devel@nongnu.org; Thu, 14 May 2015 12:09:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ysvhi-0005nD-Gg for qemu-devel@nongnu.org; Thu, 14 May 2015 12:09:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysvhi-0005n4-BX for qemu-devel@nongnu.org; Thu, 14 May 2015 12:09:46 -0400 From: Markus Armbruster References: <1431607862-9238-1-git-send-email-eblake@redhat.com> <1431607862-9238-17-git-send-email-eblake@redhat.com> Date: Thu, 14 May 2015 18:09:43 +0200 In-Reply-To: <1431607862-9238-17-git-send-email-eblake@redhat.com> (Eric Blake's message of "Thu, 14 May 2015 06:51:02 -0600") Message-ID: <87d223w37c.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: Eric Blake Cc: kwolf@redhat.com, akong@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com Eric Blake writes: > 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. I quite agree in cases such as - discriminator_type_name = '%sKind' % (name) + discriminator_type_name = name + 'Kind' I have doubts in cases such as - return "qmp_marshal_output_%s(retval, ret, &local_err);" % c_name(name) + return "qmp_marshal_output_" + c_name(name) + "(retval, ret, &local_err);" I find the old code makes it easier to grasp the result. Admittedly subjective. > Update an error message (and testsuite coverage) while at it, since > concatenating a non-string object does not always produce legible > results. The new expected test output shows improvement. > Signed-off-by: Eric Blake I'll take 01-15 now, and have a second look at this one later, okay?