Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!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; 'one?': 0.05; 'great.': 0.07; 'ascii': 0.09; 'collier': 0.09; 'function,': 0.09; 'mind,': 0.09; "people's": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sure,': 0.09; 'combinations': 0.16; 'perfect.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'restricting': 0.16; 'appropriate': 0.16; 'language': 0.16; 'wrote:': 0.18; 'library': 0.18; 'meant': 0.20; 'header:User-Agent:1': 0.23; 'comparing': 0.24; 'instead.': 0.24; 'subject:Code': 0.24; 'earlier': 0.24; 'compare': 0.26; 'certain': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'words': 0.29; 'code': 0.31; 'are.': 0.31; 'documenting': 0.31; 'done.': 0.35; 'johnson': 0.35; 'but': 0.35; 'really': 0.36; 'limitations': 0.36; 'method': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'quote': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'problems.': 0.60; 'till': 0.61; 'mentioned': 0.61; 'range': 0.61; "you're": 0.61; "you've": 0.63; 'such': 0.63; 'goal': 0.75; 'yourself': 0.78; 'future,': 0.83; 'standards,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Share Code Tips Date: Fri, 19 Jul 2013 21:51:32 -0400 References: <51e97e6e$0$29971$c3e8da3$5496439d@news.astraweb.com> <51E9B8EB.5060007@Gmail.com> <51E9E237.2040903@Gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 174.32.174.33 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: <51E9E237.2040903@Gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374285114 news.xs4all.nl 15865 [2001:888:2000:d::a6]:49551 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50938 On 07/19/2013 09:04 PM, Devyn Collier Johnson wrote: > >> > Chris Angelico said that casefold is not perfect. In the future, I want > to make the perfect international-case-insensitive if-statement. For > now, my code only supports a limited range of characters. Even with > casefold, I will have some issues as Chris Angelico mentioned. Also, "ß" > is not really the same as "ss". > Sure, the casefold() method has its problems. But you're going to avoid using it till you can do a "perfect" one? Perfect in what context? For "case sensitively" comparing people's names in a single language in a single country? Perhaps that can be made perfect. For certain combinations of language and country. But if you want to compare words in an unspecified language with an unspecified country, it cannot be done. If you've got a particular goal in mind, great. But as a library function, you're better off using the best standard method available, and document what its limitations are. One way of documenting such is to quote the appropriate standards, with their caveats. By the way, you mentioned earlier that you're restricting yourself to Latin characters. The lower() method is inadequate for many of those as well. Perhaps you meant ASCII instead. -- DaveA