Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.106 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.00; 'def': 0.10; 'oct': 0.16; 'subject: \n ': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'import': 0.21; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'replace': 0.27; 'message-id:@mail.gmail.com': 0.27; '>>>>': 0.29; 'subject:size': 0.29; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'false': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'skip:u 20': 0.36; 'subject:with': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'capital': 0.68; 'subject:NOT': 0.84; 'subject:any': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=YLOXfJLSkgJJHZ6OVPT1wUvxXLpReCtDuYTYxNPoqrg=; b=L13GV1kGsUZ1w5A7hHISu4sOKUjBsxPONNdU79LIO56+Gc9esuCB27qlG4f09PzFpy a4ewvdWHj3tVRxZFpYwZf8ZfHxB3P1JCPxqsJxHfwZzNCPJC2lnp+p3JD/f40o21LxTF rQW5IFFITC30kj6kB15XRn005yHmYT3/xQHuGvXkkL+Qf70zXSH0R/oHjoxEfEPH2AQ5 qtpqZOy0VZbMdPfJuVdVUXJzUGbWtl2rhi3qsZAnc3jJaQuMf19LamTHSKY8Le+jyfRE vyBZFE/dftldD6gjtCZ7b5PvJGmZWrQtzxCqvod36T9Vd3u6lzFrlUmpM1iDumvrCPEE u6KA== MIME-Version: 1.0 In-Reply-To: <748e561a-7e75-4b13-be6b-91831d3b59c4@googlegroups.com> References: <748e561a-7e75-4b13-be6b-91831d3b59c4@googlegroups.com> From: Ian Kelly Date: Wed, 17 Oct 2012 11:07:11 -0600 Subject: Re: Script for finding words of any size that do NOT contain vowels with acute diacritic marks? To: Python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350493663 news.xs4all.nl 6929 [2001:888:2000:d::a6]:45290 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31526 On Wed, Oct 17, 2012 at 9:32 AM, wrote: >>>> import unicodedata >>>> def HasDiacritics(w): > ... w_decomposed =3D unicodedata.normalize('NFKD', w) > ... return 'no' if len(w) =3D=3D len(w_decomposed) else 'yes' > ... >>>> HasDiacritics('=E9l=E9phant') > 'yes' >>>> HasDiacritics('elephant') > 'no' >>>> HasDiacritics('\N{LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON}') > 'yes' >>>> HasDiacritics('U') > 'no' Is there something wrong with True and False that you had to replace them with strings? "return len(w) !=3D len(w_decomposed)" is all you need.