Jython

Issue1023

classification
Title: String missing rsplit
Type: behaviour Severity: normal
Components: Core Versions: 2.5alpha1
Milestone:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: ntelang, pjenvey, zyasoft
Priority: normal Keywords:

Created on 2008年04月13日.06:57:52 by pjenvey, last changed 2008年07月14日.16:23:40 by zyasoft.

Files
File name Uploaded Description Edit Remove
PyString_rsplit_with_tests.diff ntelang, 2008年06月27日.23:29:41
PyString_rstrip_with_tests.diff ntelang, 2008年06月28日.15:08:17
CPythonLib_rstrip.diff ntelang, 2008年06月28日.15:09:14
Messages
msg3151 (view) Author: Philip Jenvey (pjenvey) Date: 2008年04月13日.06:57:51
str.rsplit was added in 2.4. This should be a pretty straightforward 
job, basically copy the existing split methods (there's two, one for a 
split char and one for whitespace) but start from the end.
With this and partition/rpartition str will be up to speed for 2.5, and 
there's already a patch for those 2: #1797751 
msg3309 (view) Author: Nimish Telang (ntelang) Date: 2008年06月27日.23:29:40
Hi, I have made a simple implementation of rsplit for PyString in these 
two diffs. Unicode seems to have it already. I have some tests, but not 
enough. Some tests from CPython will probably have to be included as 
well, but I couldn't find any.
msg3310 (view) Author: Philip Jenvey (pjenvey) Date: 2008年06月27日.23:35:53
There's a bunch of rsplit tests in CPython 2.5's string_tests (which is 
used by test_str and test_unicode). The asm branch has the 2.5 stdlib now 
in the CPythonLib/ dir
msg3311 (view) Author: Nimish Telang (ntelang) Date: 2008年06月28日.15:08:16
Ok, here is an updated patch with all those tests. When I run regrtest, 
I get 4 failures- test_atexit,test_cpickle,test_re and test_socket, but 
test_string works fine.
msg3312 (view) Author: Nimish Telang (ntelang) Date: 2008年06月28日.15:09:14
Also, I'm not sure whether CPythonLib/string.py should be patched to 
include rstrip, but I had to get test_string to work. Here is what I 
did.
msg3321 (view) Author: Philip Jenvey (pjenvey) Date: 2008年07月11日.20:19:15
applied to the asm branch in r4893. I also updated the string_tests to 
2.5 which should include the new rsplit tests from the stdlib
I fixed the patch to adhere to our coding standards (no tabs, fixed 
whitespace, camel case java vars)
I also removed the comment about having to use list reverse instead of a 
push because apparently CPython does the exact same thing (list.reverse) 
in this case
Thanks Nimish!
msg3322 (view) Author: Philip Jenvey (pjenvey) Date: 2008年07月11日.23:49:04
reopening to remind ourselves we need unicode rsplit. this'll use the same 
str rsplit code unless it's not a basic plane unicode string -- then, it 
needs something else
msg3323 (view) Author: Jim Baker (zyasoft) Date: 2008年07月14日.16:23:39
PyUnicode#rsplit calls PyString#rsplit (no need to be aware of UTF-16 
encoding issues)
History
Date User Action Args
2008年07月14日 16:23:40zyasoftsetstatus: open -> closed
assignee: zyasoft
messages: + msg3323
nosy: + zyasoft
priority: normal
2008年07月11日 23:49:04pjenveysetstatus: closed -> open
resolution: fixed -> accepted
messages: + msg3322
2008年07月11日 20:19:16pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg3321
versions: + 2.5alpha1
2008年06月28日 15:09:15ntelangsetfiles: + CPythonLib_rstrip.diff
messages: + msg3312
2008年06月28日 15:08:18ntelangsetfiles: + PyString_rstrip_with_tests.diff
messages: + msg3311
2008年06月27日 23:35:54pjenveysetmessages: + msg3310
2008年06月27日 23:29:41ntelangsetfiles: + PyString_rsplit_with_tests.diff
nosy: + ntelang
messages: + msg3309
2008年04月13日 06:57:52pjenveycreate

Supported by Python Software Foundation,
Powered by Roundup

AltStyle によって変換されたページ (->オリジナル) /