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


Groups > comp.lang.python > #50929

Re: Share Code Tips

Path csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.058
X-Spam-Evidence '*H*': 0.88; '*S*': 0.00; 'suddenly': 0.07; 'collier': 0.09; 'tackle': 0.09; '*file': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'letters.': 0.16; 'perfect.': 0.16; 'simplest': 0.16; 'unsafe': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'subject:Code': 0.24; 'unicode': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'unix': 0.29; 'said,': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'directory,': 0.31; 'explained': 0.31; 'steven': 0.31; 'anyone': 0.31; 'file': 0.32; 'figure': 0.32; 'skip:c 30': 0.32; 'becomes': 0.33; 'problem.': 0.35; 'something': 0.35; 'johnson': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'rather': 0.38; "couldn't": 0.39; 'extremely': 0.39; 'help,': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'solve': 0.60; 'most': 0.60; 'hope': 0.61; 'simple': 0.61; "you'll": 0.62; 'making': 0.63; '20,': 0.68; 'jul': 0.74; 'yourself': 0.78; '"most': 0.84; '2013': 0.98
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=Wtl8BlZfwWBRUKb+99PbNSoGqmjHUD/I/lqrMPZPWqI=; b=zjcxeJL1RTl/wC741TYnF6ezWpOMg2fW+2CAV+6oVA4CHQNPKgkJqJcmi5xqPk8LDN +p0JDsbUWQz0ey1KDPhmM5CCzNb61Z4A9ieW1uYSjIgV65nt8Qcr6WvlUZXGrKPMZF5t 2GXLbEjXfGQcSmlKc7wkojLmDYvdUJBlC0mc0OJOHBD1PpjETgmuWW7wGHQpsAiyK/VO jKXp+AmsjkbBvjZvy/e0Q1LR221mAnGGBgg2NN/Ovs/ehgrMXFrr10dlNiymP8OotV5K 9fYGiGATClCNxnQPc8MgE3qpotwWmUk/6pIfGMhraNfTSICZnnKE1PWgqc+cM2qz89xk vaKw==
MIME-Version 1.0
X-Received by 10.52.93.106 with SMTP id ct10mr5322847vdb.83.1374275315847; Fri, 19 Jul 2013 16:08:35 -0700 (PDT)
In-Reply-To <51E9B8EB.5060007@Gmail.com>
References <mailman.4868.1374241904.3114.python-list@python.org> <51e97e6e$0$29971$c3e8da3$5496439d@news.astraweb.com> <51E9B8EB.5060007@Gmail.com>
Date Sat, 20 Jul 2013 09:08:35 +1000
Subject Re: Share Code Tips
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4890.1374275325.3114.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374275325 news.xs4all.nl 15895 [2001:888:2000:d::a6]:37139
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50929

Show key headers only | View raw


On Sat, Jul 20, 2013 at 8:08 AM, Devyn Collier Johnson
<devyncjohnson@gmail.com> wrote:
> As for the case-insensitive if-statements, most code uses Latin letters.
> Making a case-insensitive-international if-statement would be interesting. I
> can tackle that later. For now, I only wanted to take care of Latin letters.
> I hope to figure something out for all characters.

Case insensitivity is a *hard* problem. Don't fool yourself that you
can do it with a simple line of code and have it 'just work'. All
you'll have is something that works "most of the time", and then
breaks on certain input. As Steven said, using casefold() rather than
lower() will help, but that's still not perfect. The simplest and
safest way to solve Unicode capitalization issues is to declare that
your protocol is case sensitive. I have a brother who couldn't
understand why Unix file systems have to be case sensitive (why would
anyone ever want to have "readme" and "README" in the same directory,
after all?), until I explained how majorly hard it is with i18n, and
how it suddenly becomes extremely unsafe for your *file system* to get
this wrong.

ChrisA

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


Thread

Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-19 09:51 -0400
  Re: Share Code Tips Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-19 17:59 +0000
    Re: Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-19 18:08 -0400
      Re: Share Code Tips Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-20 03:18 +0000
        Re: Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 06:07 -0400
    Re: Share Code Tips Chris Angelico <rosuav@gmail.com> - 2013-07-20 09:08 +1000
    Re: Share Code Tips Dave Angel <davea@davea.name> - 2013-07-19 19:09 -0400
    Re: Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-19 21:04 -0400
      Re: Share Code Tips Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-20 03:44 +0000
        Re: Share Code Tips David Hutto <dwightdhutto@gmail.com> - 2013-07-20 00:15 -0400
        Re: Share Code Tips David Hutto <dwightdhutto@gmail.com> - 2013-07-20 00:22 -0400
        Re: Share Code Tips David Hutto <dwightdhutto@gmail.com> - 2013-07-20 00:26 -0400
        Re: Share Code Tips David Hutto <dwightdhutto@gmail.com> - 2013-07-20 00:27 -0400
        Re: Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 06:10 -0400
        Re: Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 08:36 -0400
    Re: Share Code Tips Chris Angelico <rosuav@gmail.com> - 2013-07-20 11:13 +1000
    Re: Share Code Tips Dave Angel <davea@davea.name> - 2013-07-19 21:51 -0400
    Re: Share Code Tips David Hutto <dwightdhutto@gmail.com> - 2013-07-19 23:42 -0400
    Re: Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 06:06 -0400
    Re: Share Code Tips Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 08:20 -0400

csiph-web