This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年09月28日 03:28 by chris.jerdonek, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg171404 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年09月28日 03:28 | |
> Date: 2012年9月13日 09:42:47 -0400 > To: <docs@python.org> > Subject: [docs] Problem with the documentation for string.replace > > >From http://docs.python.org/library/string.html > > string.replace(str, old, new[, maxreplace])?<http://docs.python.org/library/string.html#string.replace> > Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxreplace is given, the first maxreplace occurrences are replaced. > > it would appear this needs to be > string.replace(old, new[, maxreplace])?<http://docs.python.org/library/string.html#string.replace> (from: http://mail.python.org/pipermail/docs/2012-September/010521.html ) |
|||
| msg171446 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2012年09月28日 12:16 | |
No it shoudn't. It works exactly as described: Return a copy of string *str* with all occurrences of substring *old* replaced by *new*. If the optional argument *maxreplace* is given, the first *maxreplace* occurrences are replaced. *str* is updated string and it is definitelly required. |
|||
| msg171447 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年09月28日 12:24 | |
Thanks, Andrew. I didn't look closely enough when reading the e-mail or I wouldn't have posted. I had assumed from the e-mail that this was in the string *method* section rather than string module. |
|||
| msg171449 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年09月28日 12:37 | |
[Reopening] It looks like at least *some* change is warranted here. Notice that all the functions document "s" for the string argument but string.replace() documents "str". However, we have (in 2.7): >>> string.replace(str='aab', old='a', new='b') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: replace() got an unexpected keyword argument 'str' >>> string.replace(s='aab', old='a', new='b') 'bbb' |
|||
| msg171451 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2012年09月28日 12:47 | |
If you want just to change parameter name in the docs — I'm ok with that. |
|||
| msg171462 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2012年09月28日 13:36 | |
Fixed in c34a177d1f38 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:36 | admin | set | github: 60276 |
| 2012年09月28日 13:36:17 | asvetlov | set | status: open -> closed resolution: fixed messages: + msg171462 stage: needs patch -> resolved |
| 2012年09月28日 12:47:21 | asvetlov | set | messages: + msg171451 |
| 2012年09月28日 12:37:02 | chris.jerdonek | set | status: closed -> open resolution: not a bug -> (no value) messages: + msg171449 stage: resolved -> needs patch |
| 2012年09月28日 12:24:41 | chris.jerdonek | set | messages: + msg171447 |
| 2012年09月28日 12:16:41 | asvetlov | set | status: open -> closed nosy: + asvetlov messages: + msg171446 resolution: not a bug stage: needs patch -> resolved |
| 2012年09月28日 03:28:48 | chris.jerdonek | create | |