[issue5416] str.replace does strange things when given a negative count

2010-09-08 Thread Senthil Kumaran
Senthil Kumaran orsent...@gmail.com added the comment: Reverted the changes in r84626 (release27-maint), r84629(py3k), r84630 (release31-maint). - Minor doc clarification included wherein maxreplace is the argument instead of maxsplit in py27. - Also, did not bother to remove -1 in

[issue5416] str.replace does strange things when given a negative count

2010-08-12 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thank you. Please do the reversion and the docstring fixup. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5416 ___

[issue5416] str.replace does strange things when given a negative count

2010-08-11 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: FWIW, we should be cautious about documenting all behaviors. It is arguable that this was an implementation detail and not a guaranteed behavior. As soon as you document it, people will rely on the API and all other

[issue5416] str.replace does strange things when given a negative count

2010-08-11 Thread Senthil Kumaran
Senthil Kumaran orsent...@gmail.com added the comment: I am fine with your proposal, Raymond. When I went about the change the docstrings, I did notice that it is not an intentional feature to provide negative values in the replace argument. The negative value (-1 as count) was being used

[issue5416] str.replace does strange things when given a negative count

2010-08-09 Thread Senthil Kumaran
Senthil Kumaran orsent...@gmail.com added the comment: Fixed the doc string for release27-maint in revision r83879. py3k (r83880) and release31-maint in r83881. -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed type: feature request - behavior

[issue5416] str.replace does strange things when given a negative count

2010-08-08 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Changing to doc issue as two people suggested. Can anyone suggest new text to add? -- assignee: georg.brandl - d...@python components: +Documentation -Interpreter Core nosy: +d...@python, terry.reedy stage: unit test needed - needs

[issue5416] str.replace does strange things when given a negative count

2009-04-05 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: -- assignee: - georg.brandl nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5416 ___

[issue5416] str.replace does strange things when given a negative count

2009-03-04 Thread David Majnemer
New submission from David Majnemer david.majne...@gmail.com: str.replace(, , asdf, -1) returns asdf, I believe this is not correct and strictly speaking not up to the documentation posted. I am of the opinion that it should function like str.replace(, , asdf, 0) which returns --

[issue5416] str.replace does strange things when given a negative count

2009-03-04 Thread Daniel Diniz
Daniel Diniz aja...@gmail.com added the comment: Confirmed in trunk and py3k. Changing to RFE, set it to behavior if you disagree. Python 2.4 does return for str.replace(, , asdf, -1), the change happened in rev46226, with the effbot adding this snippet (by Andrew Dalke?): if (maxcount

[issue5416] str.replace does strange things when given a negative count

2009-03-04 Thread Senthil
Senthil orsent...@gmail.com added the comment: And also look at the help on string.replace which sets -1 as the default value for maxsplit optional argument and which again defaults to replace-all. Clearly, maxsplit= -1 is not equal to maxsplit = 0. replace(s, old, new, maxsplit=-1) replace

[issue5416] str.replace does strange things when given a negative count

2009-03-04 Thread David W. Lambert
David W. Lambert lamber...@corning.com added the comment: I completely agree that this is a documentation issue. Also, or perhaps for foolish completeness, in http://docs.python.org/3.0/library/stdtypes.html we would point out that the following group of string methods also work for bytes and