I'm wrong or Will we fix the ducks limp?

Steven D'Aprano steve at pearwood.info
Sat Jun 4 05:12:16 EDT 2016


On Sat, 4 Jun 2016 12:50 pm, Christopher Reimer wrote:

>> Nor can you uppercase a string until the string exists:
>>
>> s = "hello world"
>> s = s.uppercase()
> 
>  >>> s = "hello world".upper()
>  >>> print(s)
> HELLO WORLD


"hello world" creates a string. Then you call .upper() on that string.

Perhaps a better example (demonstrating the impossibility) would be:

s = .upper()

but I thought that would not be clear.


> This works in Python 3. Not sure if s.uppercase() was meant as an
> example for a different language.

Nope, just not the clearest example.



-- 
Steven



More information about the Python-list mailing list