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


Groups > comp.lang.python > #107909 > unrolled thread

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

Started byStephen Hansen <me@ixokai.io>
First post2016-04-29 23:43 -0700
Last post2016-04-29 23:43 -0700
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.


Contents

  Re: Not x.islower() has different output than x.isupper() in list output... Stephen Hansen <me@ixokai.io> - 2016-04-29 23:43 -0700

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

FromStephen Hansen <me@ixokai.io>
Date2016-04-29 23:43 -0700
SubjectRe: Not x.islower() has different output than x.isupper() in list output...
Message-ID<mailman.258.1461998607.32212.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web