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


Groups > comp.lang.python > #63295

Re: "More About Unicode in Python 2 and 3"

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'elif': 0.05; 'subject:Python': 0.06; 'cc:addr:python-list': 0.11; 'def': 0.12; 'jan': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:More': 0.16; 'subject:Unicode': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; "d'aprano": 0.31; 'steven': 0.31; 'subject:About': 0.31; 'way?': 0.31; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'rather': 0.38; 'subject:"': 0.60; 'to:none': 0.92
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:cc :content-type; bh=hclqOZscy2UTl8imlAB6J0hTDT+HetEcp5HuJLyhryY=; b=TxLjcSaorrvl8KpIVphxuCrT+lHXODQRKYfLXY6tW0JmHeaP5MUEi+8RSdrupxDLME LIqoboyUqm6HTFF/OAABpHhmJSeTV/0ZzcxUjwkOlES1Jd5mCYHjHFNFQdq/74c09155 KcOgMFuHbe0b5fhydiIV5UMxpGFAX9AdAusQ8iQG4QstyQ0fruTWL/Q3kD52hNkXLz2C yAnJgE35Yi//9b5oU8uEfxGG1NNNxgP3xiH7FGuqE7lSlmmtis/4H//BihDYHDZJPd0w nRjRb1D9JUwStX0pj/HWimAhLD+wsml1gGE8WugnHz4v9Wt5jLwgPGH5kjQ9J5Kiu/hs lNsg==
MIME-Version 1.0
X-Received by 10.68.162.66 with SMTP id xy2mr8430636pbb.46.1389025817486; Mon, 06 Jan 2014 08:30:17 -0800 (PST)
In-Reply-To <52cad8b4$0$29984$c3e8da3$5496439d@news.astraweb.com>
References <lablra$1mc$2@ger.gmane.org> <labmaj$8u2$1@ger.gmane.org> <lad05k$gf6$1@ger.gmane.org> <CAPTjJmqBeoTLxXiKVcsvk395qgKt+Qv+jF_sOpzi7CgZmBjQcw@mail.gmail.com> <52CA13BD.4050708@stoneleaf.us> <mailman.5001.1388976943.18130.python-list@python.org> <roy-7ED5DF.23241105012014@news.panix.com> <52cad8b4$0$29984$c3e8da3$5496439d@news.astraweb.com>
Date Tue, 7 Jan 2014 03:30:17 +1100
Subject Re: "More About Unicode in Python 2 and 3"
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.5027.1389025821.18130.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389025822 news.xs4all.nl 2893 [2001:888:2000:d::a6]:50220
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63295

Show key headers only | View raw


On Tue, Jan 7, 2014 at 3:24 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> If you don't want to use the codec, you can do it by hand:
>
> def rot13(astring):
>     result = []
>     for c in astring:
>         i = ord(c)
>         if ord('a') <= i <= ord('m') or ord('A') <= i <= ord('M'):
>             i += 13
>         elif ord('n') <= i <= ord('z') or ord('N') <= i <= ord('Z'):
>             i -= 13
>         result.append(chr(i))
>     return ''.join(result)
>
> But why would you want to do it the slow way?

Eww. I'd much rather use .translate() than that :)

ChrisA

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


Thread

Re: "More About Unicode in Python 2 and 3" Chris Angelico <rosuav@gmail.com> - 2014-01-06 13:55 +1100
  Re: "More About Unicode in Python 2 and 3" Roy Smith <roy@panix.com> - 2014-01-05 23:24 -0500
    Re: "More About Unicode in Python 2 and 3" Tim Chase <python.list@tim.thechases.com> - 2014-01-05 22:41 -0600
      Re: "More About Unicode in Python 2 and 3" Roy Smith <roy@panix.com> - 2014-01-05 23:49 -0500
        Re: "More About Unicode in Python 2 and 3" Chris Angelico <rosuav@gmail.com> - 2014-01-06 15:59 +1100
    Re: "More About Unicode in Python 2 and 3" Chris Angelico <rosuav@gmail.com> - 2014-01-06 15:51 +1100
    Re: "More About Unicode in Python 2 and 3" Tim Chase <python.list@tim.thechases.com> - 2014-01-06 05:49 -0600
    Re: "More About Unicode in Python 2 and 3" Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-07 03:24 +1100
      Re: "More About Unicode in Python 2 and 3" Chris Angelico <rosuav@gmail.com> - 2014-01-07 03:30 +1100
    Re: "More About Unicode in Python 2 and 3" Serhiy Storchaka <storchaka@gmail.com> - 2014-01-06 22:20 +0200
    Re: "More About Unicode in Python 2 and 3" Serhiy Storchaka <storchaka@gmail.com> - 2014-01-06 22:21 +0200
    Re: "More About Unicode in Python 2 and 3" Tim Chase <python.list@tim.thechases.com> - 2014-01-06 14:42 -0600
    Re: "More About Unicode in Python 2 and 3" Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-06 20:47 +0000
    Re: "More About Unicode in Python 2 and 3" Chris Angelico <rosuav@gmail.com> - 2014-01-07 10:06 +1100

csiph-web