Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103716

Re: General computer language, syntax question.

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 <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: General computer language, syntax question.
Date Mon, 29 Feb 2016 07:54:05 -0700
Lines 15
Message-ID <mailman.13.1456757647.20602.python-list@python.org> (permalink)
References <5b619ffa-aae6-4fa8-9f62-58532668ec93@googlegroups.com> <f6536a77-6f32-4af7-bf2d-126b92ec5649@googlegroups.com> <b03495c3-bef8-4060-be15-bf96cedf072b@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de 9xQGuGcHDuZZobChTaFUrw0YuVyu0NbECrCFVSLCN59w==
Return-Path <ian.g.kelly@gmail.com>
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; '&gt;': 0.18; 'email addr:gmail.com&gt;': 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 <b03495c3-bef8-4060-be15-bf96cedf072b@googlegroups.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103716

Show key headers only | View raw


On Feb 29, 2016 7:11 AM, <jonas.thornvall@gmail.com> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

General computer language, syntax question. jonas.thornvall@gmail.com - 2016-02-29 05:45 -0800
  Re: General computer language, syntax question. jonas.thornvall@gmail.com - 2016-02-29 05:56 -0800
    Re: General computer language, syntax question. jonas.thornvall@gmail.com - 2016-02-29 06:05 -0800
      Re: General computer language, syntax question. Joel Goldstick <joel.goldstick@gmail.com> - 2016-02-29 09:38 -0500
      Re: General computer language, syntax question. Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-29 07:54 -0700
    Re: General computer language, syntax question. Steven D'Aprano <steve@pearwood.info> - 2016-03-01 22:42 +1100
  Re: General computer language, syntax question. Joel Goldstick <joel.goldstick@gmail.com> - 2016-02-29 08:55 -0500
  Re: General computer language, syntax question. MRAB <python@mrabarnett.plus.com> - 2016-02-29 14:07 +0000
  Re: General computer language, syntax question. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-02-29 14:39 +0000
  Re: General computer language, syntax question. Joel Goldstick <joel.goldstick@gmail.com> - 2016-02-29 09:48 -0500

csiph-web