Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'float': 0.05; 'strings.': 0.07; 'python': 0.09; 'be:': 0.09; 'friday,': 0.09; 'subject:while': 0.09; 'to:addr:comp.lang.python': 0.09; 'typeerror:': 0.09; 'cc:addr:python-list': 0.10; 'sat,': 0.15; 'called,': 0.16; 'declaration,': 0.16; 'expected,': 0.16; 'omitted,': 0.16; 'syntax,': 0.16; 'wrote:': 0.17; 'integer': 0.17; 'feb': 0.19; 'import': 0.21; 'cc:2**0': 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; 'am,': 0.27; 'actual': 0.28; 'chris': 0.28; 'restricted': 0.29; 'array': 0.29; 'johnson': 0.32; 'that!': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'should': 0.36; 'being': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'your': 0.60; 'news': 0.68; 'fact,': 0.69; '2013': 0.84; 'actually,': 0.84; 'thing,': 0.84; 'do:': 0.91; 'rick': 0.91; 'imagine': 0.96 X-Received: by 10.49.1.162 with SMTP id 2mr731078qen.2.1360472050316; Sat, 09 Feb 2013 20:54:10 -0800 (PST) Newsgroups: comp.lang.python Date: Sat, 9 Feb 2013 20:54:10 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.196.110.82; 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> <75c82449-773e-4077-a6c9-e9cef08f845f@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 70.196.110.82 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: 1360472059 news.xs4all.nl 6887 [2001:888:2000:d::a6]:53788 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38555 On Friday, February 8, 2013 7:17:26 PM UTC-6, Chris Angelico wrote: > On Sat, Feb 9, 2013 at 11:49 AM, Rick Johnson > > nested_list = array(array(string)) > > Actually, that's not a declaration, that's an assignment; and in Pike, > a 'type' is a thing, same as it is in Python (though not quite). If I > were to declare it in Pike, it would be: > > array(array(string)) nested_list; > > Though the part inside the parens can be omitted, in which case the > array can contain anything, rather than being restricted to strings. > In actual fact, Rick, despite your complaints about the syntax, it's > able to achieve exactly what you were thinking Python should do: > declare an array/list that contains only numbers. Well Chris i have wonderful news for you! Python /does/ have "homogenous arrays", and they're called, wait for it......... arrays! Imagine that! py> import array py> intSeq = array.array('i') py> intSeq.append(1) py> intSeq.append(2) py> intSeq.append(5000) py> intSeq.append(5000.333) TypeError: integer argument expected, got float py> intSeq.append('5000.333') TypeError: an integer is required