Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Not x.islower() has different output than x.isupper() in list output... Date: Tue, 3 May 2016 20:25:17 +1000 Lines: 21 Message-ID: References: <572407AE.1070703@icloud.com> <1461979797.3824480.593944273.0B8D8DF3@webmail.messagingengine.com> <57241097.7020801@icloud.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 0bEWFXfT5JOYWdruUfjSTgifjExPyn8eFJGmihvqt5SA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'true,': 0.04; 'cc:addr :python-list': 0.09; 'behave': 0.09; 'result.': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:209.85.213.176': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Not': 0.16; 'wrote:': 0.16; 'string': 0.17; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'exists.': 0.22; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'subject:list': 0.26; '(which': 0.26; 'message- id:@mail.gmail.com': 0.27; 'turns': 0.27; 'function': 0.28; "i'm": 0.30; 'certain': 0.31; 'another': 0.32; 'true.': 0.33; 'case,': 0.34; 'tue,': 0.34; 'received:google.com': 0.35; 'false': 0.35; 'identity': 0.35; 'but': 0.36; 'skip:i 20': 0.36; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'sure': 0.39; 'does': 0.39; 'more': 0.63; 'chrisa': 0.84; 'to:none': 0.91; 'thing,': 0.93 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; bh=QNajeH34saU3SXEus+4lierNYvgSH0V2NJ6R035mUII=; b=qoiTpKkKwaExSinrLsFbs+7uPt/pabG9lW5VNcP+jSJpncGOBY54LMzRGy0SIEHgdZ ZC7I9Psf4TUQBRKnnGWvvdh127WRYkCiIbTb0MG5YEuwbSSrC4TzknoScCXXMBbKpmb9 5Sq1vkGe3Y3uvLixJQE8PnIVFOE97JIiKGiV6lpzbHHzv2l1YKFUGuDscM70jsVwkQe0 corF50LoQTi3/lCJljTcWAWxb4ZiXUgEDh3p5pi9iPIX+ZuQaOyta0rp0e2+f9inUegC BqkeqPAbYQ7dlOtB/FFg70fOxS501QUK2lNQ8xlvo6QHjuXfpDNHUbSSh1axvLDOoUzp JD4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=QNajeH34saU3SXEus+4lierNYvgSH0V2NJ6R035mUII=; b=hrGglAqdWKIa1vY6YDzVatsp3LwLf470VxPx5xcTCGe3EWia5pw1Uj7ai7zAyjX9se lA7HBM1Ow1aOVNyD/FhwQj+GV7RaUGBT6w2CCKhKbEA8pRkXUzve1sj4Wd8kMiVL2k5N m3xWts5cu8hhTmqGuR6bAguTA4KWZkUDTwuiAvEvKYjIvPA1/tWASny6gimEEmXaSlk7 93gg61aoilyocB37FHctMU2JxsbWx2XvGNuFTdeGGQcu5kawTGW0ShcnciSq4RFHVP8f dUMirHDlKTQ1tt/QwJYgXfFFZNf9iO4IYaCFr0N2a5gvCpDTO0zEkJUotL4KkY0Nd8Bg 9WXA== X-Gm-Message-State: AOPr4FUSkoRyOT+tFtDpGv2CXhVPtHOF0iwSX9lkVtkH25y1a5Xq6xFcuz7B5VsTKcqvcjGQvMYY0XhW/P1Dog== X-Received: by 10.50.123.132 with SMTP id ma4mr2400045igb.92.1462271117791; Tue, 03 May 2016 03:25:17 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <572407AE.1070703@icloud.com> <1461979797.3824480.593944273.0B8D8DF3@webmail.messagingengine.com> <57241097.7020801@icloud.com> Xref: csiph.com comp.lang.python:108054 On Tue, May 3, 2016 at 8:00 PM, wrote: > > What you should have been expecting is a symmetry. Say you have a string G. islower(G) will return a certain result. Now take every letter in G and swap the case, and call that string g. isupper(g) will always return the same result is islower(G). > > More succinctly, for any string x, the following is always ture: > > islower(x) == isupper(swapcase(x)) > > But that is not the same thing, and does not imply, as the following identity (which it turns out is not always true, as we've seen): > > islower(x) == not isupper(x) > > > Another example of functions that behave like this are ispositive and isnegative. The identity "ispositive(x) == isnegative(-x)" is always true. However, "ispositive(x) == not isnegative(x)" is false if x == 0. > This assumes, of course, that there is a function swapcase which can return a string with case inverted. I'm not sure such a function exists. ChrisA