Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

no string.downer() ?

2 views
Skip to first unread message

ssecorp

unread,
Aug 27, 2008, 10:16:55 AM8/27/08
to
if i want to make a string downcase, is upper().swapcase() the onyl
choice? there is no downer() ?

Guilherme Polo

unread,
Aug 27, 2008, 10:24:02 AM8/27/08
to ssecorp, pytho...@python.org
On Wed, Aug 27, 2008 at 11:16 AM, ssecorp <circul...@gmail.com> wrote:
> if i want to make a string downcase, is upper().swapcase() the onyl
> choice? there is no downer() ?

There is no "downer" indeed, instead it is named "lower".

> --
> http://mail.python.org/mailman/listinfo/python-list
>

--
-- Guilherme H. Polo Goncalves

Jon Clements

unread,
Aug 27, 2008, 10:25:37 AM8/27/08
to
On Aug 27, 3:16 pm, ssecorp <circularf...@gmail.com> wrote:
> if i want to make a string downcase, is upper().swapcase() the onyl
> choice? there is no downer() ?

lower()

You need to be careful ssecorp, you might be at risk of being
considered a troll -- always give the benefit though (probably why I'm
broke!)

Jon.

Fredrik Lundh

unread,
Aug 27, 2008, 1:17:15 PM8/27/08
to pytho...@python.org
ssecorp wrote:

> if i want to make a string downcase, is upper().swapcase() the onyl
> choice?

what you're asking for is usually called "lower case":

http://en.wikipedia.org/wiki/Lower_case

and the corresponding string method method is called "lower":

>>> "HELLO".lower()
'hello'

> there is no downer() ?

no, that would be no fun at all.

</F>

Terry Reedy

unread,
Aug 27, 2008, 7:53:43 PM8/27/08
to pytho...@python.org

ssecorp wrote:
> if i want to make a string downcase, is upper().swapcase() the onyl
> choice? there is no downer() ?

If you are not being a troll, there are two easy ways to answer such a
question.

>>> dir('')
['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
'__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__',
'__getnewargs__', '__gt__', '__hash__', '__init__', '__iter__',
'__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__',
'__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__',
'_formatter_field_name_split', '_formatter_parser', 'capitalize',
'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format',
'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier',
'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper',
'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace',
'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split',
'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate',
'upper', 'zfill']

followed by
>>> help(''.lower)
Help on built-in function lower:
lower(...)
S.lower() -> str
Return a copy of the string S converted to lowercase.

OR
>>> help(str)
which gives screenfuls of info including the above.

tjr

John Machin

unread,
Aug 27, 2008, 8:28:15 PM8/27/08
to
On Aug 28, 9:53 am, Terry Reedy <tjre...@udel.edu> wrote:
> ssecorp wrote:
> > if i want to make a string downcase, is upper().swapcase() the onyl
> > choice? there is no downer() ?
>
> If you are not being a troll, there are two easy ways to answer such a
> question.
>

[snip]

Reading the manual backwards as the OP seems to have done ("upper",
"swapcase", ...) one finds:

"""
swapcase( )

Return a copy of the string with uppercase characters converted to
lowercase and vice versa.
"""

Out of the possible diagnoses (trolling, incredible stupidity, feeble
joke attempt) of the cause of the ensuing upper/downer question, I'm
going with the third.

Timothy Grant

unread,
Aug 27, 2008, 9:18:23 PM8/27/08
to python
> --
> http://mail.python.org/mailman/listinfo/python-list
>

I was going to go with not particularly strong in English. To someone
not familiar with English, downer() could very well be the obvious
converse of upper().

I'm usually quick to think "troll" but this time I didn't. Maybe I'm just naive.

--
Stand Fast,
tjg. [Timothy Grant]

Asun Friere

unread,
Aug 27, 2008, 9:25:30 PM8/27/08
to
On Aug 28, 10:28 am, John Machin <sjmac...@lexicon.net> wrote:

> Out of the possible diagnoses (trolling, incredible stupidity, feeble
> joke attempt) of the cause of the ensuing upper/downer question, I'm
> going with the third.

Never ascribe to humour that which can be adequately explained by
increadible stupidity! On the other hand given up/down vs. high/low,
upper/downer might appear logical to someone who doesn't know that
"downcase" is called 'lowercase.'

John Machin

unread,
Aug 27, 2008, 9:34:14 PM8/27/08
to

He knows that s.upper().swapcase() does the job, without having read
the swapcase docs where it is screamingly obvious that lowercase is
the antonym of uppercase???

Grant Edwards

unread,
Aug 27, 2008, 9:42:38 PM8/27/08
to
On 2008-08-28, Timothy Grant <timoth...@gmail.com> wrote:

> I was going to go with not particularly strong in English. To
> someone not familiar with English, downer() could very well be
> the obvious converse of upper().

Not only does one need to be familiar with English, but one
also has to be familiar with somewhat obscure terms dervied
from ancient typsetting practices. In other contexts, downer is
definitely the obvious converse of upper.

--
Grant

Terry Reedy

unread,
Aug 27, 2008, 11:20:10 PM8/27/08
to pytho...@python.org

Grant Edwards wrote:

> Not only does one need to be familiar with English, but one
> also has to be familiar with somewhat obscure terms dervied
> from ancient typsetting practices. In other contexts, downer is
> definitely the obvious converse of upper.

Nonsense. Down is the opposite of up, but lower is the opposite of upper
as an adjective: upper level, lower level; upper class, lower class,
upper case, lower case, upper rank, lower rank, upper lip, lower lip;
upper arm, lower arm; upper leg, lower leg; upper house, lower house (of
a legislature); upper layer, lower layer; Upper Paleolithic, Lower
Paleolithic (and so on for other geologic periods; upper Manhattan,
lower Manhattan (and so on for other persiods); upper Mississippi, lower
Mississippi (and so on for other rivers).

Downer, a noun, opposes upper only when upper is used as a noun for
depressing versus stimulating things, most often with reference to drugs
It is also used to refer to animals that are so sick that they cannot
stand up or otherwise need to be 'put down' (permanently). But healthy
animals are not called uppers that I know of.

tjr

Asun Friere

unread,
Aug 27, 2008, 11:23:53 PM8/27/08
to

:shrugs, Why not? One does a dir() on one's string and sees 'upper'
and 'swapcase' (but fails to see or understand 'lower'), and takes an
educated guess at what they do. In any case that was only a caveat to
the point I was trying to make, namely that you were probably being
too generous towards said poster.

Fredrik Lundh

unread,
Aug 28, 2008, 1:52:42 AM8/28/08
to pytho...@python.org
Asun Friere wrote:

> Never ascribe to humour that which can be adequately explained by
> increadible stupidity! On the other hand given up/down vs. high/low,
> upper/downer might appear logical to someone who doesn't know that
> "downcase" is called 'lowercase.'

prior exposure to Ruby might explain this, right? (iirc, they use
"upcase" and "downcase").

</F>

Tobiah

unread,
Aug 28, 2008, 2:25:27 PM8/28/08
to

> Never ascribe to humour that which can be adequately explained by
> increadible stupidity!

I love the irony. Don't feel bad. I recently corrected
someone's 'grammer' with a similar tone.
** Posted from http://www.teranews.com **

Fredrik Lundh

unread,
Aug 28, 2008, 2:38:42 PM8/28/08
to pytho...@python.org
Tobiah wrote:

>> Never ascribe to humour that which can be adequately explained by
>> increadible stupidity!
>
> I love the irony.

Muphry's law.

</F>

Gabriel Genellina

unread,
Aug 29, 2008, 8:04:47 PM8/29/08
to pytho...@python.org
En Thu, 28 Aug 2008 02:52:42 -0300, Fredrik Lundh <fre...@pythonware.com>
escribi�:

> Asun Friere wrote:
>
>> Never ascribe to humour that which can be adequately explained by
>> increadible stupidity! On the other hand given up/down vs. high/low,
>> upper/downer might appear logical to someone who doesn't know that
>> "downcase" is called 'lowercase.'
>

> prior exposure to Ruby might explain this, right? (iirc, they use
> "upcase" and "downcase").

Yes. And Common Lisp has used the same very names for a longer time than
Python itself existed, so I don't agree with many comments on this thread.

--
Gabriel Genellina

0 new messages