Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Peter Otten <__peter__@web.de> Newsgroups: comp.lang.python Subject: Readability counts, was Re: Use of Lists, Tupples, or Sets in IF statement. Date: Tue, 15 Mar 2016 09:29:50 +0100 Organization: None Lines: 17 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 7N4JuSNWacSEHb9ABBQ5tQ1HKZ5ZsYzNAYLsbIDPiZ0A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'modify': 0.04; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '"this': 0.13; 'grasp': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.16; 'versions': 0.20; 'thus': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'distribute': 0.27; 'print': 0.30; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40; 'readers': 0.66; 'subject:Sets': 0.84; 'subject:Lists': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57bd8ad5.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104923 Rustom Mody wrote: > Others have answered some parts >>>> if x in x_list: > ... print("That is a fruit.") > ... else: > ... print("That is not a fruit.") > ... > > However one can distribute the print out of the if; Thus > >>>> "This is %s a fruit" % ("" if x in x_list else "not") Which of the two versions will most readers grasp at first sight? Which one is easier to modify so that it works for arbitrary attributes? Which one is easier to internationalize?