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


Groups > comp.lang.python > #97076

Re: Python, convert an integer into an index?

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 <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.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 <jeanmichel@sequans.com>
Subject Re: Python, convert an integer into an index?
Date Thu, 24 Sep 2015 16:14:02 +0200
References <e6e800a2-a64c-47dc-87b3-c6d32b6fca2f@googlegroups.com> <201509222221.t8MMLMi5015927@fido.openend.se> <mailman.87.1442977993.28679.python-list@python.org> <vg3pp18x8e6.fsf@coffee.modeemi.fi> <5603FAEE.1060101@mrabarnett.plus.com> <CAJ4+4aqWJA6ktbD49i_hqa4JPutUjoeb-VSf-O_Svan74W5aPg@mail.gmail.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 <CAJ4+4aqWJA6ktbD49i_hqa4JPutUjoeb-VSf-O_Svan74W5aPg@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Newsgroups comp.lang.python
Message-ID <mailman.128.1443104074.28679.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python, convert an integer into an index? Chris Roberts <thecjguy1@gmail.com> - 2015-09-22 14:43 -0700
  Re: Python, convert an integer into an index? Laura Creighton <lac@openend.se> - 2015-09-23 00:21 +0200
  Re: Python, convert an integer into an index? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-23 00:23 +0100
  Re: Python, convert an integer into an index? MRAB <python@mrabarnett.plus.com> - 2015-09-23 00:27 +0100
    Re: Python, convert an integer into an index? marco.nawijn@colosso.nl - 2015-09-22 23:55 -0700
  Re: Python, convert an integer into an index? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-22 23:13 -0400
    Re: Python, convert an integer into an index? Anssi Saari <as@sci.fi> - 2015-09-23 12:01 +0300
      Re: Python, convert an integer into an index? MRAB <python@mrabarnett.plus.com> - 2015-09-24 14:30 +0100
      Re: Python, convert an integer into an index? jmp <jeanmichel@sequans.com> - 2015-09-24 16:14 +0200
      Re: Python, convert an integer into an index? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-24 21:26 -0400
  Re: Python, convert an integer into an index? Denis McMahon <denismfmcmahon@gmail.com> - 2015-09-23 15:32 +0000
    Re: Python, convert an integer into an index? Lorenzo Sutton <lorenzofsutton@gmail.com> - 2015-09-24 18:13 +0200
  Re: Python, convert an integer into an index? Tim Daneliuk <tundra@bogus-city.tundraware.com> - 2015-09-23 10:55 -0500

csiph-web