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


Groups > comp.lang.python > #103711

Re: General computer language, syntax question.

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Subject Re: General computer language, syntax question.
Date Mon, 29 Feb 2016 08:55:19 -0500
Lines 59
Message-ID <mailman.8.1456754608.20602.python-list@python.org> (permalink)
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 I01nOJ1QoReSSeCSGKumxAxl0Ci6sRXo5dtc3s1qIgpA==
Return-Path <joel.goldstick@gmail.com>
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; 'received:209.85.223': 0.03; 'skip:[ 20': 0.03; 'javascript,': 0.07; 'cc:addr:python- list': 0.09; '"if': 0.09; 'empty,': 0.09; 'subject:language': 0.09; 'python': 0.10; '&gt;&gt;&gt;': 0.15; 'skip:1 30': 0.15; '2016': 0.16; 'boolean': 0.16; 'cyclic': 0.16; 'empty.': 0.16; 'exhausted': 0.16; 'javascript"': 0.16; 'nodes': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'element': 0.18; 'email addr:gmail.com&gt;': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'programming': 0.22; 'am,': 0.23; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'mon,': 0.24; 'script': 0.25; 'message-id:@mail.gmail.com': 0.27; 'entries': 0.27; "skip:' 10": 0.28; 'skip:( 20': 0.28; 'node': 0.29; 'subset': 0.29; 'array': 0.29; 'print': 0.30; 'url:mailman': 0.30; 'skip:[ 10': 0.31; 'problem': 0.33; 'url:python': 0.33; 'lock': 0.33; 'url:listinfo': 0.34; 'languages': 0.34; 'add': 0.34; 'received:google.com': 0.35; 'false': 0.35; 'but': 0.36; 'list,': 0.36; 'should': 0.36; 'instead': 0.36; 'there': 0.36; 'url:org': 0.36; 'possible.': 0.36; 'received:209.85': 0.36; 'skip:{ 10': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'skip:& 10': 0.37; 'turn': 0.37; 'list.': 0.37; 'seem': 0.37; 'received:209': 0.38; 'sure': 0.39; 'url:mail': 0.40; 'more': 0.63; 'due': 0.65; 'beautiful': 0.66; 'url:info': 0.71; 'lack': 0.76; 'networks,': 0.79; 'madness.': 0.84; 'subject:General': 0.84; 'joel': 0.91
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 :cc; bh=kHDQ9lJQQlmiYapfYvpOAl8VjzjUnpVaK61ZLLbFBtE=; b=03QBEKRJ8h/ru7ObKVRasDVP86+GSfDvtojnoF2iY6Drc8PsVfVu/PJNIJ4AgtUYRU /XCDX37M2vkBzS6O+NXg/frj6GCWdtUKfZDzxa5ujmxIVnBpyHhWOcfnCTdJ7gmNzfnS XoQ3ZtwORzemqRKf0d6ndwayzOaejXUVKVa6MylliLTSlB27s8K9xCoIRslnYi7B5ouM Re50eE1rmlefnsyZb9rISTi8BpBCt0m5SIeKpKcYyePaeStWbCiehbdWEDMiSA2si/y3 Y9LJeE1D9NwxAbSL2FW+97FM2VOJez/cWcjMg2VCZERArAn1PpLndEpugSuwmYl8wWzl 2Dmg==
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:cc; bh=kHDQ9lJQQlmiYapfYvpOAl8VjzjUnpVaK61ZLLbFBtE=; b=Aem6OH0qtVOGV2DH7+KsPSFcsVVBSTF8jx4Ul8QhSFgjW6fiDz6bz///KFrJhJzT8p XIdWPAESKQ0i4nj7Z4kQMEYYtE61BY0K0vSOD5ODt19Qk/Ed0JOZvkcmcHCoGh6tWIIk /D4FuCwi3Ui/bpqtYKmNB2hlAIHuUjdhf3/zx+NQ5+PRwPMnEcsbDrMkhjKlKLk5/7Dz sISMxcleRQ2Bh9e25COYYq2Wx8hOqerYsUQIYcRK1VrVI9KzkHZEyfwe+AA9GiL6XrPP 40M46TgkfrN2k/Pq/tmIqAX1Th/ro3EFCzICN2nRhyL81JOu0H1qWlMC2NwSUrVxhwYu Ns6A==
X-Gm-Message-State AG10YOQd6bIG7skx8rIhevtNqtt9XoBO+X0KkvVzDCmH6J4amC5FmPro9C046ziEJxKKd4IqhM2IgUYNcsl1jA==
X-Received by 10.107.10.147 with SMTP id 19mr17962488iok.46.1456754119927; Mon, 29 Feb 2016 05:55:19 -0800 (PST)
In-Reply-To <5b619ffa-aae6-4fa8-9f62-58532668ec93@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:103711

Show key headers only | View raw


On Mon, Feb 29, 2016 at 8:45 AM, <jonas.thornvall@gmail.com> wrote:

> I have a problem programming uniform networks, "x nodes with y links" that
> turn out to be really hairy to solve for me and i feel i really lack the
> programming features
>
> "Actually i program in javascript" but the problem seem general for all
> programming languages including Pyhton.
>
> For a beautiful solution it would require "If in list/array return
> boolean" "If not in list/array return boolean".
>
> But there is no such feature Python nor Javascript, so instead i set
> boolean value "inlist" to false and loop thru, to see if it is already in
> list. If not it is added to list.
>
> So if the current node i generate links for is x and i try to generate a
> link to  node z, and z's links exhausted i will add it to exhausted list.
>
> And if there is node-x exhausted entries in list, well then script should
> break because it will lock into a cycle. The cyclic lockup is due to only a
> subset of the networks on the form (links*deep)+1=nodes is possible.
>
> So what i need is to know howto write "if list/array ***empty*** do
> {something}"
>
> I sure know howto check if an array have 1 element 2,3,4 but how do you
> check for empty.
>
> I think it is crazy that you can not do general comparissons of the type
> If in list/array
> If not in list/array
>
> But it is even more crazy that you can not check if list/array is empty,
> that is just madness.
> --
> https://mail.python.org/mailman/listinfo/python-list
>

>>> l = [1,2,3,4]
>>> if 1 in l:
...   print 1
...
1
>>> if 6 in l:
...   print 1
...
>>>
>>> l = []
>>> if len(l) == 0:
...   print 'empty'
...
empty


-- 
Joel Goldstick
http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
http://cc-baseballstats.info/

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