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


Groups > comp.lang.python > #107909

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
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 Fri, 29 Apr 2016 23:43:24 -0700
Lines 29
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>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de f13rH6L8kKGhoPcEEv3L8A3u8AR74CdFeqy071Y8fHaw==
Return-Path <me@ixokai.io>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'character,': 0.07; 'false.': 0.07; 'received:internal': 0.09; 'situation.': 0.09; 'subject: \n ': 0.15; '"o"': 0.16; 'cased': 0.16; 'islower': 0.16; 'lower,': 0.16; 'lowercase': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.44': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:compute4.internal': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:Not': 0.16; 'wrote:': 0.16; 'string': 0.17; 'documented': 0.18; 'function,': 0.22; 'stephen': 0.22; 'pass': 0.22; 'passing': 0.23; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'subject:list': 0.26; 'fri,': 0.27; 'least': 0.27; 'character': 0.29; 'holds': 0.32; 'run': 0.33; 'true.': 0.33; 'definition': 0.34; 'false': 0.35; 'filter': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'to:addr:python.org': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.61
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=ixokai.io; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=EoCDCxxEe36a+VgBhhf+IzMEOVU=; b=ncvF1h HH0/ffqFbyDoppwdEJFIUFpYm8gw3UzKJtCWoY2IVrknhqx+hQjaG6iD0Zkk/oYW WydyIanUyxjmXIQhnsuDx0vePlaCJ/6YLr9x++TiifxrxEnh9fNOjIedxiEM6oZg 7s1ZbDchjpHWix/1cDmF1ymGGwm3Ryj5nhYfk=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=EoCDCxxEe36a+Vg Bhhf+IzMEOVU=; b=khNy5ZfUE8AJ5hTFAa3FBCX4lmHB/uboYbHPspchTJzuYmH J1zYF7DH0ezjm4I/0ASjGm8N9q68Ua38ITzq+/UGDCUG8XI4Lqdli4PuL0l8ej7L 9vNp34NUlFM8EdbadgO9NE2JcyPE5hKwZeu0JkNYA/b8kv999NRNhrxIx5jE=
X-Sasl-Enc G7cqWz4cAYoqVPIATxmV8bGdrwmHO7yuS1id4qd64fx5 1461998604
X-Mailer MessagingEngine.com Webmail Interface - ajax-491eb5a4
In-Reply-To <57241097.7020801@icloud.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <1461998604.3888861.594056577.710E696D@webmail.messagingengine.com>
X-Mailman-Original-References <572407AE.1070703@icloud.com> <1461979797.3824480.593944273.0B8D8DF3@webmail.messagingengine.com> <57241097.7020801@icloud.com>
Xref csiph.com comp.lang.python:107909

Show key headers only | View raw


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


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