no string.downer() ?

S

ssecorp

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

Guilherme Polo

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".
 
J

Jon Clements

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.
 
T

Terry Reedy

ssecorp said:
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.
['__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 byHelp on built-in function lower:
lower(...)
S.lower() -> str
Return a copy of the string S converted to lowercase.

ORwhich gives screenfuls of info including the above.

tjr
 
J

John Machin

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.
 
T

Timothy Grant

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.

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.
 
A

Asun Friere

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.'
 
J

John Machin

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.'

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???
 
T

Terry Reedy

Grant said:
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
 
A

Asun Friere

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???

: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.
 
F

Fredrik Lundh

Asun said:
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>
 
G

Gabriel Genellina

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top