On Sun, May 1, 2016 at 2:48 AM, Christopher Reimer
<christopher_rei...@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
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to