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


Groups > comp.lang.python > #107917

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 Sat, 30 Apr 2016 10:11:49 -0700
Lines 32
Message-ID <mailman.264.1462036312.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> <5724E1CF.9060905@icloud.com> <1462036309.4005755.594329209.1106AF27@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de SYCfrxTz2d0xIP/zvNiKXwTU2U2fdKQT6BGnF7Qd1Nig==
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; 'test,': 0.05; 'false.': 0.07; 'run,': 0.07; 'implies': 0.09; 'received:internal': 0.09; 'unpack': 0.09; 'subject: \n ': 0.15; 'cased': 0.16; 'doing:': 0.16; 'lowercase': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'operation.': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'string:': 0.16; 'subject:Not': 0.16; 'wrote:': 0.16; 'string': 0.17; 'basically': 0.18; 'stephen': 0.22; 'am,': 0.23; 'seems': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'subject:list': 0.26; 'least': 0.27; 'otherwise.': 0.27; 'character.': 0.29; 'that.': 0.30; 'getting': 0.33; 'text': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'operating': 0.37; 'received:66': 0.38; 'test': 0.39; 'skip:x 10': 0.40; 'to:addr:python.org': 0.40; 'header:Message-Id:1': 0.61; '30,': 0.63; 'packing': 0.84; 'substrings': 0.84
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=D3nO9VB0nargQ/R1nE8VEMKAJms=; b=X9oK5P 1bv2t6LRu+u5KIylzgohrCdaMBNJWju3I+PrIzAf87p2ni5oWia59SzqoQRWfnCX hkrrybyAk8phBy31GWyHiUrZ+azaXdCV0AMAqYkUUpQcNB2MzkPQI5Qctv/95wjp mKdqBSWBj6soz7KfNmtIgkf4VFAtomObdTb1o=
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=D3nO9VB0nargQ/R 1nE8VEMKAJms=; b=C2qSGk4okCZE1dMEPNhuBt9KDStcLQkdZJxNLhnv2MEHtdV jA+S3LIONOF7XW1FqY2xnHrxQN3JYiQ83aWLE/KO6p3MQLSedwINgqwUIMuoG/mg YwzMRHNYApMzBBwwlQzkEUaKr/gWHjKEBP4NtpxKBGbDTOq5qLvUE/X2c+ts=
X-Sasl-Enc ss3UFXm9Z3tkZJr0UYZKRlcyflfg46/vRhhjDQ13i/b3 1462036309
X-Mailer MessagingEngine.com Webmail Interface - ajax-491eb5a4
In-Reply-To <5724E1CF.9060905@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 <1462036309.4005755.594329209.1106AF27@webmail.messagingengine.com>
X-Mailman-Original-References <572407AE.1070703@icloud.com> <1461979797.3824480.593944273.0B8D8DF3@webmail.messagingengine.com> <57241097.7020801@icloud.com> <1461998604.3888861.594056577.710E696D@webmail.messagingengine.com> <5724E1CF.9060905@icloud.com>
Xref csiph.com comp.lang.python:107917

Show key headers only | View raw


On Sat, Apr 30, 2016, at 09:48 AM, Christopher Reimer 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. 

That's the thing -- no it doesn't. The documentation is very specific:
if all cased characters in the string are lowercase, and there's at
least one cased character.

It only seems to because you're packing a loop and test on substrings
into an operation.

   list(filter((lambda x: not x.islower()), string))

Let's unpack that. This is basically what you're doing:

    result = []
    for ch in string:
        if not ch.islower():
            result.append(ch)

You're thinking of the whole "string", but you're operating on
single-character substrings, and when " ".islower() is run, its false.
Because the two-pronged test, a) if all cased characters are lowercase
and b) there is at least one cased character. b) is failing. Ergo,
you're getting the underscores.

-- 
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-30 10:11 -0700

csiph-web