[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-12 Thread Steve Dower


Steve Dower  added the comment:

Oh, apart from the What's New section. But this looks enough like a bugfix 
(previous behaviour "wasn't capitalizing my name correctly" - new behaviour 
"now capitalizes my name correctly") that it's hardly critical to advertise it 
on that page.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-12 Thread Steve Dower


Steve Dower  added the comment:

What is missing? It looks like everything on Serhiy's list was done.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-12 Thread Zackery Spytz


Zackery Spytz  added the comment:

I think that the PR may have been merged too quickly. Serhiy had made a list, 
and I think that the PR was missing some necessary changes.

--
nosy: +ZackerySpytz

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-12 Thread Steve Dower


Steve Dower  added the comment:

Thanks! I'm a big fan of this change :)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-12 Thread Steve Dower


Steve Dower  added the comment:


New changeset b015fc86f7b1f35283804bfee788cce0a5495df7 by Steve Dower (Kingsley 
M) in branch 'master':
bpo-36549: str.capitalize now titlecases the first character instead of 
uppercasing it (GH-12804)
https://github.com/python/cpython/commit/b015fc86f7b1f35283804bfee788cce0a5495df7


--
nosy: +steve.dower

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-12 Thread Kingsley McDonald


Change by Kingsley McDonald :


--
keywords: +patch
pull_requests: +12731
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-10 Thread Kingsley McDonald


Kingsley McDonald  added the comment:

Thanks for clarifying all of that! I now have the patch and tests working 
locally. However, I'm not too sure what documentation needs to be changed for 
str.title. Should it specify that only the first letter of digraphs are 
capitalised, rather than the full character?
I sure hope I get the hang of this soon :-D

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This issue is easy if you know C.

* Find the implementation of str.capitalize in unicodeobject.c and make it 
using the title case. See on the implementation of str.title for example.

* Find tests for str.capitalize and aďd new cases. Finding the proper place for 
test may be the hardest part.

* Update the documentation for str.capitalize. Add the versionchanged directive.

* Fix the documentation for str.title. Use str.capitalize in the example.

* Add the news and What's New entries.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-10 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-09 Thread Kingsley McDonald


Kingsley McDonald  added the comment:

Hello there,

I'm an absolute beginner here and this whole thing is a little overwhelming, so 
please bear with me. I think this would be a suitable first task for me to take 
on because it appears to be a simple one-line change (correct me if I'm 
mistaken, though).

--
nosy: +kingsley

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think this is a reasonable change.

Also the docs for str.title() should be fixed.

--
components: +Interpreter Core, Unicode
keywords: +easy (C)
nosy: +ezio.melotti, serhiy.storchaka, vstinner
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-07 Thread Steven D'Aprano

New submission from Steven D'Aprano :

str.capitalize appears to uppercase the first character of the string, which is 
okay for ASCII but not for non-English letters.

For example, the letter NJ in Croatian appears as Nj at the start of words when 
the first character is capitalized:

Njemačka ('Germany'), not NJemačka.

(In ASCII, that's Njemacka not NJemacka.)

https://en.wikipedia.org/wiki/Gaj's_Latin_alphabet#Digraphs

But using any of:

U+01CA LATIN CAPITAL LETTER NJ
U+01CB LATIN CAPITAL LETTER N WITH SMALL LETTER J
U+01CC LATIN SMALL LETTER NJ 

we get the wrong result with capitalize:


py> 'NJemačka'.capitalize()
'NJemačka'
py> 'Njemačka'.capitalize()
'NJemačka'
py> 'njemačka'.capitalize()
'NJemačka'


I believe that the correct behaviour is to titlecase the first code point and 
lowercase the rest, which is what the Apache library here does:

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#capitalize-java.lang.String-

--
messages: 339568
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: str.capitalize should titlecase the first character not uppercase

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com