Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'builtin': 0.07; "'w',": 0.09; 'friday,': 0.09; 'method:': 0.09; 'subject:while': 0.09; 'to:addr:comp.lang.python': 0.09; 'yeah,': 0.09; 'cc:addr:python- list': 0.10; "'e',": 0.16; "'o',": 0.16; "'r',": 0.16; 'folks,': 0.16; 'happily': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'java': 0.21; 'together.': 0.21; 'cc:2**0': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:[ 10': 0.26; 'chris': 0.28; 'url:se': 0.29; 'definition': 0.29; 'no,': 0.29; 'objects': 0.29; "i'm": 0.29; 'stuff': 0.30; 'not.': 0.32; 'received:google.com': 0.34; 'list': 0.35; 'sequence': 0.35; 'but': 0.36; 'wanted': 0.36; 'subject:: ': 0.38; 'url:docs': 0.38; 'sure': 0.38; 'your': 0.60; 'first': 0.61; 'sum': 0.66; 'yourself': 0.77; '2013': 0.84; 'pike': 0.84; 'url:tutorial': 0.93 X-Received: by 10.49.28.162 with SMTP id c2mr606527qeh.41.1360370943338; Fri, 08 Feb 2013 16:49:03 -0800 (PST) Newsgroups: comp.lang.python Date: Fri, 8 Feb 2013 16:49:02 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.196.111.123; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj References: <5002a1f9$0$29995$c3e8da3$5496439d@news.astraweb.com> <7b027612-a07e-40f9-8ad2-3e95c5440482@googlegroups.com> <86872ad2-fda0-403b-9f18-d1cb18e41860@t32g2000yqd.googlegroups.com> <50039290$0$29978$c3e8da3$5496439d@news.astraweb.com> <9309333c-13a0-464c-bd94-9c682363b8c9@googlegroups.com> <511516db$0$29969$c3e8da3$5496439d@news.astraweb.com> <62c3e7bb-d023-43b4-b759-f424707fd346@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 70.196.111.123 MIME-Version: 1.0 Subject: Re: Implicit conversion to boolean in if and while statements From: Rick Johnson To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360370952 news.xs4all.nl 6946 [2001:888:2000:d::a6]:48497 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38484 On Friday, February 8, 2013 6:05:54 PM UTC-6, Chris Angelico wrote: > The sum builtin works happily on any sequence of objects > that can be added together. It works as an excellent > flatten() method: > > >>> nested_list = [["q"], ["w","e"], ["r","t","u"], ["i","o","p"]] > >>> sum(nested_list,[]) > ['q', 'w', 'e', 'r', 't', 'u', 'i', 'o', 'p'] > >>> nested_list > [['q'], ['w', 'e'], ['r', 't', 'u'], ['i', 'o', 'p']] What the hell? Oh yeah, you must be using pike again. No, if it were pike the list would look like this: ({({"q"}), ({"w","e"}), ({"r","t","u"}), ({"i","o","p"})}) Of course you'd have to declare it first using an /expanded/ Java syntax: nested_list = array(array(string)) Folks, i couldn't make this stuff up if i wanted to. Go read for yourself if want a few laughs. http://pike.lysator.liu.se/docs/tutorial/data_types/container_types.xml > I'm not sure what your definition of a numeric type is, but I suspect > that list(str) isn't part of it. Of course not.