Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!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; 'subject:Python': 0.05; 'constructor': 0.07; 'list?': 0.07; 'strings.': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'iterable,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; 'string': 0.17; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'function': 0.28; 'convert': 0.29; "i'm": 0.30; 'list': 0.34; 'something': 0.35; 'should': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'wanted': 0.37; 'why': 0.39; 'to:addr:python.org': 0.40; 'received:194': 0.61; 'side': 0.62; 'email addr:gmail.com': 0.62; 'charset:windows-1252': 0.62 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: jmp Subject: Re: Python, convert an integer into an index? Date: Thu, 24 Sep 2015 16:14:02 +0200 References: <201509222221.t8MMLMi5015927@fido.openend.se> <5603FAEE.1060101@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: paris.sequans.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1443104074 news.xs4all.nl 23736 [2001:888:2000:d::a6]:52838 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97076 On 09/24/2015 03:45 PM, paul.hermeneutic@gmail.com wrote: > >> I'm suprised. Why not just: > >> > >> list(str(results)) > >> > >> In other words, is there something else the list constructor should do > >> with a string other than convert it to a list? > >> > > The OP wanted the result to be a list of ints, not a list of strings. > > [int(x) for x in list(str(results))] Side note : strings are already iterable, the list function is superfluous. jm