Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107909
| From | Stephen Hansen <me@ixokai.io> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Not x.islower() has different output than x.isupper() in list output... |
| Date | 2016-04-29 23:43 -0700 |
| Message-ID | <mailman.258.1461998607.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> |
On Fri, Apr 29, 2016, at 06:55 PM, Christopher Reimer wrote: > On 4/29/2016 6:29 PM, Stephen Hansen wrote: > > If isupper/islower were perfect opposites of each-other, there'd be no > > need for both. But since characters can be upper, lower, or *neither*, > > you run into this situation. > > Based upon the official documentation, I was expecting perfect opposites. > > str.islower(): "Return true if all cased characters [4] in the string > are lowercase and there is at least one cased character, false > otherwise." The thing is, your use of filter is passing a string of 1 character long to your function, and so when it comes up against a string " ", there are no cased characters. Therefore, false. The documentation holds true. Your use of filter is breaking "Whiskey Tango Foxtrot" into ["W", "h", "i", ... "o" t"] and calling not x.islower() vs x.isupper() on each. When it comes up against " ", it doesn't pass the documented definition of what islower defines. The official documentation is accurate. -- Stephen Hansen m e @ i x o k a i . i o
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Not x.islower() has different output than x.isupper() in list output... Stephen Hansen <me@ixokai.io> - 2016-04-29 23:43 -0700
csiph-web