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 -- https://mail.python.org/mailman/listinfo/python-list