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

2016-05-04 Thread DFS
On 5/4/2016 11:37 AM, Steven D'Aprano wrote: On Thu, 5 May 2016 12:09 am, DFS wrote: On 5/3/2016 11:28 PM, Steven D'Aprano wrote: Languages with two distinct lettercases, like English, are called bicameral. [...] Linguist much? Possibly even a cunning one. I see you as more of a

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

2016-05-04 Thread Steven D'Aprano
On Thu, 5 May 2016 12:09 am, DFS wrote: > On 5/3/2016 11:28 PM, Steven D'Aprano wrote: >> Languages with two distinct lettercases, like English, are called >> bicameral. [...] > Linguist much? Possibly even a cunning one. Somebody-had-to-say-it-ly y'rs, -- Steven --

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

2016-05-04 Thread Chris Angelico
On Thu, May 5, 2016 at 12:09 AM, DFS wrote: > On 5/3/2016 11:28 PM, Steven D'Aprano wrote: >> [ lengthy piece about text, Unicode, and letter case ] > > Linguist much? As an English-only speaker who writes code that needs to be used around the world, you end up accruing tidbits

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

2016-05-04 Thread DFS
On 5/3/2016 11:28 PM, Steven D'Aprano wrote: On Wed, 4 May 2016 12:49 am, Jussi Piitulainen wrote: DFS writes: On 5/3/2016 9:13 AM, Chris Angelico wrote: It doesn't invert, the way numeric negation does. What do you mean by 'case inverted'? It looks like it swaps the case correctly

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

2016-05-04 Thread Steven D'Aprano
On Wednesday 04 May 2016 18:34, Gregory Ewing wrote: > Jussi Piitulainen wrote: >> Ceterum censeo, the only suggested use for .swapcase I've ever heard of >> is encryption. > > Yep, all the smart terrorists these days are using a > combination of swapcase and rot13. Totally bamboozles > the FBI.

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

2016-05-04 Thread Gregory Ewing
Jussi Piitulainen wrote: Ceterum censeo, the only suggested use for .swapcase I've ever heard of is encryption. Yep, all the smart terrorists these days are using a combination of swapcase and rot13. Totally bamboozles the FBI. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

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

2016-05-03 Thread Steven D'Aprano
On Wed, 4 May 2016 12:49 am, Jussi Piitulainen wrote: > DFS writes: > >> On 5/3/2016 9:13 AM, Chris Angelico wrote: > >>> It doesn't invert, the way numeric negation does. >> >> What do you mean by 'case inverted'? >> >> It looks like it swaps the case correctly between upper and lower. > >

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

2016-05-03 Thread Steven D'Aprano
On Wed, 4 May 2016 12:42 am, Jussi Piitulainen wrote: > Ceterum censeo, the only suggested use for .swapcase I've ever heard of > is encryption. iF YOU'RE PROGRAMMING AN EDITOR, sWAP cASE IS REALLY USEFUL FOR THOSE LITTLE capslock ACCIDENTS THAT PLAGUE TYPISTS. -- Steven --

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

2016-05-03 Thread Terry Reedy
On 5/3/2016 11:42 AM, Grant Edwards wrote: Interesting. FWIW, Å and Å definitely look different with the terminal and font I'm using (urxvt with -misc-fixed-medium-r-normal-*-18-120-*-*-*-90-iso10646-*) In the fixed pitch font used by Thunderbird (Courier?), Angstrom Å has the circle

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

2016-05-03 Thread Grant Edwards
On 2016-05-03, Jussi Piitulainen wrote: >> Does that mean: >> >> lower(Å) != å ? >> >> and >> >> upper(å) != Å ? > > It means "\N{ANGSTROM SIGN}" != "Å", yet both lower to "å", which then > uppers back to "Å" (U+00c5). > > The Ångström sign (U+212b) looks like

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

2016-05-03 Thread Jussi Piitulainen
DFS writes: > On 5/3/2016 10:49 AM, Jussi Piitulainen wrote: >> DFS writes: >> >>> On 5/3/2016 9:13 AM, Chris Angelico wrote: >> It doesn't invert, the way numeric negation does. >>> >>> What do you mean by 'case inverted'? >>> >>> It looks like it swaps the case correctly between upper and

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

2016-05-03 Thread DFS
On 5/3/2016 10:49 AM, Jussi Piitulainen wrote: DFS writes: On 5/3/2016 9:13 AM, Chris Angelico wrote: It doesn't invert, the way numeric negation does. What do you mean by 'case inverted'? It looks like it swaps the case correctly between upper and lower. There's letters that do not

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

2016-05-03 Thread Jussi Piitulainen
DFS writes: > On 5/3/2016 9:13 AM, Chris Angelico wrote: >> It doesn't invert, the way numeric negation does. > > What do you mean by 'case inverted'? > > It looks like it swaps the case correctly between upper and lower. There's letters that do not come in exact pairs of upper and lower case,

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

2016-05-03 Thread Jussi Piitulainen
Chris Angelico writes: > On Tue, May 3, 2016 at 9:25 PM, Jussi Piitulainen wrote: >> Chris Angelico writes: >> >>> This assumes, of course, that there is a function swapcase which can >>> return a string with case inverted. I'm not sure such a function >>> exists. >> >>str.swapcase("foO") >>

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

2016-05-03 Thread Chris Angelico
On Tue, May 3, 2016 at 11:19 PM, DFS wrote: > What do you mean by 'case inverted'? > > It looks like it swaps the case correctly between upper and lower. I gave two examples in my previous post. Did you read them? You trimmed them from the quote. ChrisA --

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

2016-05-03 Thread DFS
On 5/3/2016 9:13 AM, Chris Angelico wrote: On Tue, May 3, 2016 at 11:01 PM, DFS wrote: On 5/3/2016 8:00 AM, Chris Angelico wrote: On Tue, May 3, 2016 at 9:25 PM, Jussi Piitulainen wrote: Chris Angelico writes: This assumes, of course, that

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

2016-05-03 Thread Chris Angelico
On Tue, May 3, 2016 at 11:01 PM, DFS wrote: > On 5/3/2016 8:00 AM, Chris Angelico wrote: >> >> On Tue, May 3, 2016 at 9:25 PM, Jussi Piitulainen >> wrote: >>> >>> Chris Angelico writes: >>> This assumes, of course, that there is a function

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

2016-05-03 Thread DFS
On 5/3/2016 8:00 AM, Chris Angelico wrote: On Tue, May 3, 2016 at 9:25 PM, Jussi Piitulainen wrote: Chris Angelico writes: This assumes, of course, that there is a function swapcase which can return a string with case inverted. I'm not sure such a function

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

2016-05-03 Thread Chris Angelico
On Tue, May 3, 2016 at 9:25 PM, Jussi Piitulainen wrote: > Chris Angelico writes: > >> This assumes, of course, that there is a function swapcase which can >> return a string with case inverted. I'm not sure such a function >> exists. > >str.swapcase("foO") >

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

2016-05-03 Thread Jussi Piitulainen
Chris Angelico writes: > This assumes, of course, that there is a function swapcase which can > return a string with case inverted. I'm not sure such a function > exists. str.swapcase("foO") 'FOo' -- https://mail.python.org/mailman/listinfo/python-list

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

2016-05-03 Thread Chris Angelico
On Tue, May 3, 2016 at 8:00 PM, wrote: > > What you should have been expecting is a symmetry. Say you have a string G. > islower(G) will return a certain result. Now take every letter in G and swap > the case, and call that string g. isupper(g) will always return

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

2016-05-03 Thread pavlovevidence
On Friday, April 29, 2016 at 6:55:56 PM UTC-7, 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

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

2016-04-30 Thread Christopher Reimer
On 4/30/2016 10:11 AM, Stephen Hansen wrote: 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

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

2016-04-30 Thread Stephen Hansen
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

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

2016-04-30 Thread Chris Angelico
On Sun, May 1, 2016 at 2: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

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

2016-04-30 Thread Christopher Reimer
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. Maybe I'm nitpicking this. Even if I submitted a bug to request a clearer explanation in the

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

2016-04-30 Thread Stephen Hansen
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. > >

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

2016-04-29 Thread Gregory Ewing
Christopher Reimer wrote: str.islower(): "Return true if all cased characters [4] in the string are lowercase and there is at least one cased character, false otherwise." str.isupper(): "Return true if all cased characters [4] in the string are uppercase and there is at least one cased

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

2016-04-29 Thread Chris Angelico
On Sat, Apr 30, 2016 at 11:55 AM, 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 >>

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

2016-04-29 Thread Christopher Reimer
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.

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

2016-04-29 Thread Stephen Hansen
On Fri, Apr 29, 2016, at 06:17 PM, Christopher Reimer wrote: > Greetings, > > I was playing around with a piece of code to remove lowercase letters > and leave behind uppercase letters from a string when I got unexpected > results. > > string = 'Whiskey Tango Foxtrot' > >

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

2016-04-29 Thread Christopher Reimer
Greetings, I was playing around with a piece of code to remove lowercase letters and leave behind uppercase letters from a string when I got unexpected results. string = 'Whiskey Tango Foxtrot' list(filter((lambda x: not x.islower()), string)) ['W', ' ', 'T', ' ', 'F'] Note