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


Groups > comp.lang.python > #91616

Re: What use for reversed()?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <timothy.c.delaney@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.033
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'string.': 0.04; 'python': 0.11; 'syntax': 0.13; 'output': 0.15; 'gently': 0.16; 'iterator': 0.16; 'wrote:': 0.16; '(on': 0.22; '2.x': 0.22; 'fixing': 0.22; 'lawrence': 0.22; '2015': 0.23; "i've": 0.24; 'header:In-Reply- To:1': 0.24; 'tim': 0.24; 'error': 0.27; 'message- id:@mail.gmail.com': 0.28; 'colon': 0.29; 'e.g.': 0.31; 'to:name :python-list': 0.31; 'print': 0.31; 'subject:use': 0.33; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'done': 0.35; 'something': 0.35; 'statement': 0.36; 'should': 0.37; 'subject:: ': 0.37; 'instead': 0.38; 'end': 0.39; 'to:addr:python.org': 0.39; 'mark': 0.40; 'back': 0.61; 'per': 0.61; 'to,': 0.63; 'complete': 0.63; 'reverse': 0.66; 'delaney': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=kD1WDFKH1etPn9l7afl2WBBCmcLx/r/qrFmLjz65Qi8=; b=gj6Ju81OF9apLJXFyV+Q2udVSaFgNX18EyFZC4a9Xr1EEOEgXDXr/vaaJbtxMm91kZ QHa9WUJQjuH79zAEOSSWoPE6ZIsfur11npBm59yACajYaUeETw6h3YA2pgUQFyjtbzaE 11hYwybfjh1yscT3maxY2MpE0825a89SlSNX+UO9bauxysP7BN1zqxG8x35qDy2KxnbD uKRXTcvocbmQ3rQ1l6xQCGSgqClhVGqEhCr+STeVYPNC4rjciP6N7gEX/p6h3vyNTvsC +merPcQQ93/T7rt795Mzwmt4pP07aC7VYpfwUSKSgUFYFzmikaqiqR0HuNYzBszuhq+I 8Nqg==
MIME-Version 1.0
X-Received by 10.194.90.100 with SMTP id bv4mr35930665wjb.143.1433131141573; Sun, 31 May 2015 20:59:01 -0700 (PDT)
In-Reply-To <mkg93i$1pd$1@ger.gmane.org>
References <514c05fc-dded-4278-ac86-3e8e3cd0e851@googlegroups.com> <CAN8CLgnm3ZVzzZHB4306nQdKh3Xwu8fBpL25P1Cy1+0EpvG=6g@mail.gmail.com> <mkg93i$1pd$1@ger.gmane.org>
Date Mon, 1 Jun 2015 13:59:01 +1000
Subject Re: What use for reversed()?
From Tim Delaney <timothy.c.delaney@gmail.com>
To Python-List <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7bfceb069c33af05176cd8b7
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.263.1433133429.5151.python-list@python.org> (permalink)
Lines 66
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433133429 news.xs4all.nl 2931 [2001:888:2000:d::a6]:48793
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91616

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 1 June 2015 at 10:30, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:

> On 01/06/2015 00:23, Tim Delaney wrote:
>
>> The for statement must have a colon at the end of line e.g. a complete
>> for statement and block is:
>>
>> for br in b:
>>      print br
>>
>> This will output the characters one per line (on Python 3.x), since that
>> is what the reversed() iterator will return. You will need to do
>> something else to get it back to a single string.
>>
>
> Will it indeed?  Perhaps fixing the syntax error will get something to
> print :)


Indeed - as Mark is so gently alluding to, I've done the reverse of what I
said - given Python 2.x syntax instead of Python 3.x.

That should have been:

for br in b:
     print(br)

Tim Delaney

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


Thread

What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 12:40 -0700
  Re: What use for reversed()? Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-31 19:58 +0000
    Re: What use for reversed()? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-31 18:06 -0600
  Re: What use for reversed()? cheshire <supportNOSPAM@microsoft.com> - 2015-05-31 23:26 +0200
  Re: What use for reversed()? Tim Delaney <timothy.c.delaney@gmail.com> - 2015-06-01 09:23 +1000
    Re: What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 20:11 -0700
  Re: What use for reversed()? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-01 01:30 +0100
  Re: What use for reversed()? Tim Delaney <timothy.c.delaney@gmail.com> - 2015-06-01 13:59 +1000
  Re: What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 22:15 -0700
    Re: What use for reversed()? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-01 09:11 +0300

csiph-web