Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103716
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: General computer language, syntax question. |
| Date | 2016-02-29 07:54 -0700 |
| 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> |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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