Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1218782imu; Wed, 16 Jan 2019 15:03:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN4poi9fkasAxqpISaKFtmcLd1VhUQkqC67cA8fEJy/a2WQDkkx4dSyh5UptdKrWU22d3G0B X-Received: by 2002:a65:500c:: with SMTP id f12mr10964327pgo.226.1547679822628; Wed, 16 Jan 2019 15:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547679822; cv=none; d=google.com; s=arc-20160816; b=TsDQC2ywZ6LSFfYcL8ro5RwvvcXAVM9TMlpLbsWQrnILPbTLu8EWr5E7jz/dBxk4Ew f2eJ/ZBNRzkHmT6jTqZDwBMxu9Jf4EJgVahOV/0j/zlRHH07TPbhlZzUedjaLHu3CqC0 +3ldfVC5SrlpsYzhaZ+EKXfqEWIiCEtAnPMoRzJQYS0tjblpB4TdYb5oZ+fgx1faIJDF EzmwMTDR4/tjoy+6q6eMtEom6o4Yu6FL8bEDKExJlh4Zbh50ZbsjSmBMCS4JcKsVa6ZN RrVoTgd8YcWV/Q8GgdGQCB5A7VJeKvPyKCmwmL0FTHFHl5ec9WHkLazx5+KCvUaxSHln T6LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=l+ocrz/3lceK8EXHdR0g7eYdHaBpq+BBgrQsamn7cC0=; b=tbjHKrtHDIMlSgPHeRp3zIKaih4/eEL3JxlIK8uhgRZtfOugsIg3NtKv1/V83fk3yG tTNUDcAN/xjKuALrjM5C2NYn0fNTL9RuoHDQNs+x9iMaxlFk/Ur0tX7gVfjiQZQiWZCk QqZeHggDANDI8mbyqpsmBbVQ68owveFzj0SS2OFmeLhtHXp5VFkG9B6HJskmItJyGWhu 0qekk9sGCUW+VEsZA1LVp9Q4BPIcDlMiejvPZXTins6D7440fBejrNnuhDgRC9OphEMd OfwBzi4wfJ/RMZuPLocFML9skYFvGvKiEDx9TOE/6mOCYw2WNzDooAg92ahe3v9goae/ uOtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si7014259pgh.560.2019.01.16.15.03.23; Wed, 16 Jan 2019 15:03:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405692AbfAPQcf (ORCPT + 99 others); Wed, 16 Jan 2019 11:32:35 -0500 Received: from ms.lwn.net ([45.79.88.28]:51036 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbfAPQcf (ORCPT ); Wed, 16 Jan 2019 11:32:35 -0500 Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 6A469300; Wed, 16 Jan 2019 16:32:34 +0000 (UTC) Date: Wed, 16 Jan 2019 09:32:33 -0700 From: Jonathan Corbet To: Seeteena Thoufeek Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, ravi.bangoria@linux.ibm.com Subject: Re: [PATCH] perf scripts python: Add Python 3 support to mem-phys-addr.py Message-ID: <20190116093233.4873b784@lwn.net> In-Reply-To: <1547655825-28754-8-git-send-email-s1seetee@linux.vnet.ibm.com> References: <1547655825-28754-1-git-send-email-s1seetee@linux.vnet.ibm.com> <1547655825-28754-8-git-send-email-s1seetee@linux.vnet.ibm.com> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Jan 2019 21:53:36 +0530 Seeteena Thoufeek wrote: > Support both Python 2 and Python 3 in mem-phys-addr.py. ``print`` is now a > function rather than a statement. This should have no functional change. > > Fix lambda syntax error. So, I just picked one of these at random.... > Signed-off-by: Seeteena Thoufeek > Reviewed-by: Ravi Bangoria > --- > tools/perf/scripts/python/mem-phys-addr.py | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/scripts/python/mem-phys-addr.py b/tools/perf/scripts/python/mem-phys-addr.py > index ebee2c5..52fe9bd 100644 > --- a/tools/perf/scripts/python/mem-phys-addr.py > +++ b/tools/perf/scripts/python/mem-phys-addr.py > @@ -38,14 +38,14 @@ def parse_iomem(): > pmem.append(long(m[1], 16)) > > def print_memory_type(): > - print "Event: %s" % (event_name) > - print "%-40s %10s %10s\n" % ("Memory type", "count", "percentage"), > - print "%-40s %10s %10s\n" % ("----------------------------------------", \ > - "-----------", "-----------"), > + print("Event: %s" % (event_name)) > + print("%-40s %10s %10s\n" % ("Memory type", "count", "percentage")), > + print("%-40s %10s %10s\n" % ("----------------------------------------", \ > + "-----------", "-----------")), You have not added "from __future__ import print_function", so you're relying on a Python 2 parsing oddity to make this work. If anybody ever adds a second parameter, things will break. I think that if you really want to support both versions (which seems like the right goal) you should add the import and do it properly. Thanks, jon