Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Joel Goldstick Newsgroups: comp.lang.python Subject: Re: General computer language, syntax question. Date: Mon, 29 Feb 2016 09:38:50 -0500 Lines: 69 Message-ID: References: <5b619ffa-aae6-4fa8-9f62-58532668ec93@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de bt54qYow/bn7Ww3ggvKrTAX2AWHrzNCxYq5MJpcl+1UQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'javascript,': 0.07; 'undefined': 0.07; 'cc:addr:python- list': 0.09; '"if': 0.09; 'empty,': 0.09; 'subject:language': 0.09; 'python': 0.10; '!==': 0.16; '&&': 0.16; '(typeof': 0.16; '2016': 0.16; 'alot': 0.16; 'ass': 0.16; 'boolean': 0.16; 'cyclic': 0.16; 'empty.': 0.16; 'exhausted': 0.16; 'javascript"': 0.16; 'nodes': 0.16; 'null.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'element': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'null)': 0.22; '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; 'example': 0.26; 'message- id:@mail.gmail.com': 0.27; 'entries': 0.27; 'skip:( 20': 0.28; 'node': 0.29; 'subset': 0.29; 'array': 0.29; 'url:mailman': 0.30; 'problem': 0.33; 'url:python': 0.33; 'lock': 0.33; 'url:listinfo': 0.34; 'equal': 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; 'needed': 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; 'say': 0.37; 'list.': 0.37; 'seem': 0.37; 'received:209': 0.38; 'mailing': 0.38; 'mean': 0.38; 'sure': 0.39; 'url:mail': 0.40; 'your': 0.60; 'more': 0.63; 'due': 0.65; 'beautiful': 0.66; 'url:info': 0.71; 'lack': 0.76; 'networks,': 0.79; 'descriptive': 0.84; 'madness.': 0.84; 'subject:General': 0.84; 'to:none': 0.91; 'joel': 0.91; 'luck': 0.95 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:cc; bh=76OoT5J0RcNlmAsKPyMb57/3LD6qwDxQyVWYPEa0fzE=; b=CwGA5AZdpkRrHLpCKOdpPSINk4Thuxtc+V20inQX9XzaBJWf3STwzH7xhGogw6SIy/ 06Sz8P6HNhH721lOPIY+AxcunMZsOZc4j6q+VLF5Fmcmzw7x1ByyOQ9+gjCuzN/U05rY 3qMOeTxt4UnlwgxLy/evtyL2voRySYUsDpUO/5I/rWj4drzR1LBnpIIVu6CZtT5BMsPc 0mWKlOCItpK6Muzc8lv7HNIsb/AZnFgRJASrrtTledOOhKgtY2VydvMCqvY2sxhn3Nd7 TIZO/O8+x7TBiHxWNmNnYFMMXHS9ZnMj/nkQnhUzAJdADKXvmKONy3JGi/FzsqEAg4Dl E9Jg== 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:cc; bh=76OoT5J0RcNlmAsKPyMb57/3LD6qwDxQyVWYPEa0fzE=; b=Q3cYoyRm331EYbev9Ku8bcCHoN2atFpTH6TQGrgdqGUendpbw8uCXQu4nPImJdgsxk 6EuabE5rbnBv809dB/D1sMvGlLre2BT5xJz5Zj3BE5P6nfnANDIXJlOYN9dVYw6VX42y zBb5Ky4WQTGn7ihrqTnL4qAV9tBGCH61ZQuh/xvZ/SdL7YUelZspzO7+hxSICiSwHc+A y445lYlXYxurJe0cJ8Fz0V3btgRxQiZ+p4c1m12rFnWYNqV7EQXo+6pBPXIOsPJPEL04 Jjb+YKTGRFZ7d1ia/glWjlRspDMV8qlSXsN9RwQuRKJbsycSApTM61HyS8oXscphlgNx ehlQ== X-Gm-Message-State: AG10YOT88a0sHDO3IUW8zqr+dXZ24fNpuqPvIJUr0EUClzF4v6lJAUodzz7OhzllK3evQtOB5kts45fjMysEKg== X-Received: by 10.107.10.147 with SMTP id 19mr18179969iok.46.1456756730149; Mon, 29 Feb 2016 06:38:50 -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:103714 On Mon, Feb 29, 2016 at 9:05 AM, wrote: > Den m=C3=A5ndag 29 februari 2016 kl. 14:57:04 UTC+1 skrev jonas.t...@gmai= l.com: > > Den m=C3=A5ndag 29 februari 2016 kl. 14:45:37 UTC+1 skrev > jonas.t...@gmail.com: > > > 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 generat= e > a link to node z, and z's links exhausted i will add it to exhausted lis= t. > > > > > > 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=3Dnodes is possi= ble. > > > > > > 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. > > > > I mean for for example Javascript > > if (typeof array[index] !=3D=3D 'undefined' && array[index] !=3D=3D nul= l) { > > or this one > > if (array[index] !=3D null) { > > > > I mean how do they come up with such convoluted syntax, do they pull it > out of ass? Well one can always say it is needed because undefined not > equal to null. > > > > But would not if (array[index]=3D=3Dempty) suffice and be alot clearer? > > Sorry but would not if (array=3D=3Dempty) suffice and be alot clearer? > -- > https://mail.python.org/mailman/listinfo/python-list > You might have better luck on a javascript mailing list. Not sure crazy, madness, ass are descriptive to your problems --=20 Joel Goldstick http://joelgoldstick.com/ http://cc-baseballstats.info/