Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107916 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2016-05-01 03:00 +1000 |
| Last post | 2016-05-01 03:00 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Not x.islower() has different output than x.isupper() in list output... Chris Angelico <rosuav@gmail.com> - 2016-05-01 03:00 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2016-05-01 03:00 +1000 |
| Subject | Re: Not x.islower() has different output than x.isupper() in list output... |
| Message-ID | <mailman.263.1462035611.32212.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web