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


Groups > comp.lang.python > #107916

Re: Not x.islower() has different output than x.isupper() in list output...

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Not x.islower() has different output than x.isupper() in list output...
Date Sun, 1 May 2016 03:00:02 +1000
Lines 37
Message-ID <mailman.263.1462035611.32212.python-list@python.org> (permalink)
References <572407AE.1070703@icloud.com> <1461979797.3824480.593944273.0B8D8DF3@webmail.messagingengine.com> <57241097.7020801@icloud.com> <1461998604.3888861.594056577.710E696D@webmail.messagingengine.com> <5724E1CF.9060905@icloud.com> <CAPTjJmrk+tiBA+pSi=UAAsPgpokbk4pTuxPxLGGQAYF8dRYriA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de 4RLN+KKYiIgOr/dDROnneQWv0tIgoqZhKI+fxPcdmTMg==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'bool': 0.09; 'docs.': 0.09; 'implies': 0.09; 'bug': 0.10; '2016': 0.16; 'digits.': 0.16; 'expected,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Not': 0.16; 'uppercase': 0.16; 'wording': 0.16; 'wrote:': 0.16; 'case.': 0.18; 'programmer': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'stephen': 0.22; 'am,': 0.23; 'thus': 0.24; 'header:In-Reply- To:1': 0.24; 'subject:list': 0.26; 'least': 0.27; 'message- id:@mail.gmail.com': 0.27; 'otherwise.': 0.27; 'this.': 0.28; 'concise': 0.29; "they'll": 0.29; 'character': 0.29; "i'm": 0.30; 'code': 0.30; 'everyone': 0.31; 'statement': 0.32; 'maybe': 0.33; 'doubt': 0.33; 'worked': 0.34; 'received:google.com': 0.35; 'text': 0.35; 'false': 0.35; 'instance': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'method': 0.37; 'received:209.85.213': 0.37; 'wanted': 0.37; 'received:209': 0.38; 'test': 0.39; 'sure': 0.39; 'still': 0.40; 'some': 0.40; 'obligation': 0.72; 'obvious': 0.76; 'chrisa': 0.84; 'clearer': 0.84; 'to:none': 0.91; 'checks.': 0.91
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=Dn8cU7WNxoRNfwVHmoCNk0Hjop3i+IyKd/xkZqf60n0=; b=A/GzQZYgQikzmOyU2KB4V3q4AqtEPj2YoKTMknuonXe4eqBu1+lQKYPK4uU0reEAGg 8y1E8J3ntqDKH4BA+2A0V139xrZBWDXMX3C/JKGcu8tCzjWcO32KZQ4nE6qQlNVWfmgQ UL2KWRYbPMUI8Gew+9S0dL7ZYgjZC89DCIfQpbgpdWqz7K0ef6xTgZ6n5lo8OyKWFPc+ Gma8tvg5bakiqfKA1EMkDajmpugw5kNaRUJbH8q9ZFC4H5U/6FDJBFR6unHQEqlxlGk9 Wk7Secn2nAf/9DpxBih0oXmW1H3AwLd7n/cBTcL1vqcf6DZ0/9Bvvxs1wU83LJxxO7H0 i6vg==
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=Dn8cU7WNxoRNfwVHmoCNk0Hjop3i+IyKd/xkZqf60n0=; b=NzRzDiffDeuQABLKwPxpuKU16aWu7acKd1gHu9zCjUmEEsywmV57xmN1iluHYgyuoE gkDOYZhHkxix7xSgD+eJ11NsxUK13Dq4hjNtIlV7/1xdcdfUpjxccIYlJisI/OZQkR3q oIJ8EMhxKbS69trLm3Z8TYxS30JGDoUjiFPXFR0IgTjF1z8SET9rxY+yaREzS/1ay/tX c1/Leo/HAnsrMcfjW0nyqNdCgdM66QAGOQMUV9TXwZb+sbAOujgnBgUFGj4XgUy72gNm e2PCZvcD4HInprx/9vzxbe9RH9bk4mfN1GKrCUff8RZgfEzM1lNBdUVTPGyfnJT58aX2 wvYg==
X-Gm-Message-State AOPr4FUegwrJ3pUH7EFAXejHZiApkeSdpUJzWS81AVW181tSX5A3sI6STYpo2hLBIh9BtkYEp7g3WFa+RzVpGg==
X-Received by 10.50.123.132 with SMTP id ma4mr11550844igb.92.1462035602542; Sat, 30 Apr 2016 10:00:02 -0700 (PDT)
In-Reply-To <5724E1CF.9060905@icloud.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <CAPTjJmrk+tiBA+pSi=UAAsPgpokbk4pTuxPxLGGQAYF8dRYriA@mail.gmail.com>
X-Mailman-Original-References <572407AE.1070703@icloud.com> <1461979797.3824480.593944273.0B8D8DF3@webmail.messagingengine.com> <57241097.7020801@icloud.com> <1461998604.3888861.594056577.710E696D@webmail.messagingengine.com> <5724E1CF.9060905@icloud.com>
Xref csiph.com comp.lang.python:107916

Show key headers only | View raw


On Sun, May 1, 2016 at 2:48 AM, Christopher Reimer
<christopher_reimer@icloud.com> wrote:
> On 4/29/2016 11:43 PM, Stephen Hansen wrote:
>>
>> The official documentation is accurate.
>
>
> That may be true on a technical level. But the identically worded text in
> the documentation implies otherwise. Maybe I'm nitpicking this. Even if I
> submitted a bug to request a clearer explanation in the documentation, I
> doubt it would get change. The programmer still has an obligation to test
> the code to make sure that it works as expected, which was what I did that
> until I found the concise statement that worked exactly as I wanted it to.

Let's take it away from letter case and to something that everyone
should be able to grok.

isalpha(...) method of builtins.str instance
    S.isalpha() -> bool

    Return True if all characters in S are alphabetic
    and there is at least one character in S, False otherwise.

isdigit(...) method of builtins.str instance
    S.isdigit() -> bool

    Return True if all characters in S are digits
    and there is at least one character in S, False otherwise.

It should be pretty obvious that there are some strings which are
neither alphabetic nor digits. Thus these two are not opposites,
despite the identical wording in the docs.

It's exactly the same with letter case. Some strings are neither
uppercase nor lowercase, and thus they'll be False on both checks.

ChrisA

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


Thread

Re: Not x.islower() has different output than x.isupper() in list output... Chris Angelico <rosuav@gmail.com> - 2016-05-01 03:00 +1000

csiph-web