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


Groups > comp.lang.python > #103715

Re: General computer language, syntax question.

Path csiph.com!goblin3!goblin.stu.neva.ru!news.tu-darmstadt.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Newsgroups comp.lang.python
Subject Re: General computer language, syntax question.
Date Mon, 29 Feb 2016 14:39:49 +0000
Lines 33
Message-ID <mailman.11.1456756830.20602.python-list@python.org> (permalink)
References <5b619ffa-aae6-4fa8-9f62-58532668ec93@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de V3YbUQUVO9CURXlGigPQeA4vQhmCyZGRKdXIm3CC+w9w==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.05; 'javascript,': 0.07; '"if': 0.09; 'empty,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:language': 0.09; 'python': 0.10; 'boolean': 0.16; 'cyclic': 0.16; 'empty.': 0.16; 'exhausted': 0.16; 'javascript"': 0.16; 'nodes': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'element': 0.18; 'language': 0.19; 'lawrence': 0.22; 'programming': 0.22; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'script': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'entries': 0.27; 'skip:( 20': 0.28; 'node': 0.29; 'subset': 0.29; 'array': 0.29; 'language.': 0.32; 'problem': 0.33; 'url:python': 0.33; 'lock': 0.33; 'languages': 0.34; 'add': 0.34; '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; 'url:library': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'turn': 0.37; 'received:org': 0.37; 'list.': 0.37; 'seem': 0.37; 'sure': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'url:3': 0.60; 'email addr:gmail.com': 0.62; 'charset:windows-1252': 0.62; 'more': 0.63; 'our': 0.64; 'due': 0.65; 'beautiful': 0.66; 'lack': 0.76; 'networks,': 0.79; 'madness.': 0.84; 'pythonistas,': 0.84; 'subject:General': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host 80.234.182.166
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
In-Reply-To <5b619ffa-aae6-4fa8-9f62-58532668ec93@googlegroups.com>
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:103715

Show key headers only | View raw


On 29/02/2016 13:45, 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.
>

Please see 
https://docs.python.org/3/library/stdtypes.html#truth-value-testing

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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