Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: General computer language, syntax question. Date: Mon, 29 Feb 2016 07:54:05 -0700 Lines: 15 Message-ID: References: <5b619ffa-aae6-4fa8-9f62-58532668ec93@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 9xQGuGcHDuZZobChTaFUrw0YuVyu0NbECrCFVSLCN59w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'yet.': 0.03; 'test,': 0.05; 'that?': 0.05; 'method,': 0.07; '"if': 0.09; '===': 0.09; 'subject:language': 0.09; 'python': 0.10; '"in"': 0.16; '2016': 0.16; 'alot': 0.16; 'operator.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'pointed': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; 'variable': 0.18; 'am,': 0.23; 'feb': 0.23; 'header:In-Reply- To:1': 0.24; "doesn't": 0.26; 'message-id:@mail.gmail.com': 0.27; 'container': 0.29; 'sensible': 0.29; 'problem': 0.33; 'received:google.com': 0.35; 'draft': 0.35; 'set.': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'received:209.85.213': 0.37; 'suggestion': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'subject:General': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=9q8OXJknjeM/cp03fgYM15m5D8WugRW9IMSHm4E3LAA=; b=A1gAhfGN5j3q84Kgl9NpoymN/6rTerp7L8k324vG5Ax1IPxvJ/BJo/SZG7e3UcBM1p 12KFCD9DNypVNWt9pJYeVzZhzJhPoeLj2uB1TM9lAQAM/8BDpXriZVVo5gSc+boSZmrH GSk+p/slpWI10mQRkTflgFLnmZRRs1bbSGsgNrZDy5e3g5p09pag15uPygHRqjZqNL1L TFvgQtnQyEfVCO1TNDh+1EJ/w5ORBk4XLBO5XHUcuIy34R+0NWSXAo2FyNiHoQaLgh+z XGWlTPsgiICuFJMaUTc1MaGzYAt/q9jrhKtPeD/4uDZxEI+OBRgMMvw8UCcDuKvVSFmX W78w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=9q8OXJknjeM/cp03fgYM15m5D8WugRW9IMSHm4E3LAA=; b=LqdGXS0+mfPckpvY3FLYwArpUbAIimS6xtQimFdbyu41Z2uVGZK60itCI/Twsh6t77 Yo103jXccZakh5fJHgKNgUC7lFXpVifcun4jwFlABroB78PgDkOgSvu2T+inSngHiZuu SklxY8zNPAzKAxi96Rq71lZeSIDlMt5e0Qg2Kg976xzjvzyIUFWeBQLO3oRgjIboKU+r 1UKY7OuXteOO0ewjAufiD/VMlpm2o4QooxAHVSHxlBMyapJUvyY7/UVvNry74awpU47Z y1+ge4gsVJeZDR46B5LHUanSITFkV8d8d25S71CW+yRZn/7bwgars9dULxASyPRLDjHU pBDw== X-Gm-Message-State: AD7BkJLmtiDWpwDQMBxSSDIluoOLrXPXQQdLX9Yrl+QZmtq12ZOHWoE9NKcbUm5nv3PU95tnILrGX2/sxDCsSg== X-Received: by 10.50.112.10 with SMTP id im10mr10317561igb.93.1456757645068; Mon, 29 Feb 2016 06:54:05 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.21 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:103716 On Feb 29, 2016 7:11 AM, wrote: > > Sorry but would not if (array==empty) suffice and be alot clearer? In Python, you can just do "if len(array) == 0" or "if not array". In JavaScript you have "if (array.length === 0)". Is there some problem with that? I would prefer this over your suggestion since it doesn't require some variable named "empty" to have a sensible value set. On the container test, as others pointed out, Python has the "in" operator. JavaScript has a draft Array.prototype.includes method, but it doesn't have broad cross-browser support yet.