digitalmars.D - Python's partition
- Andrei Alexandrescu (15/15) Jan 22 2011 Looking through Python's string functions
-
so
(3/18)
Jan 22 2011
splitAt? I think "split
" is much better then "partition". - Torarin (2/2) Jan 22 2011 Divide? As in dividing a pie chart.
- spir (6/20) Jan 22 2011 separate(d)
- Christopher Nicholson-Sauls (3/23) Jan 22 2011 Bisect?
- Andrei Alexandrescu (3/26) Jan 22 2011 Would be rather trisect, but that becomes a bit too cute.
- bearophile (4/5) Jan 22 2011 "trisect" name is acceptable :-)
- Christopher Nicholson-Sauls (5/36) Jan 22 2011 Yeah, you're right. I hit on "bi-" because my mental image was like a
- foobar (3/23) Jan 22 2011 sounds like JavaScript's split:
- Tomek =?ISO-8859-2?Q?Sowi=F1ski?= (8/25) Jan 22 2011 =20
Looking through Python's string functions (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed partition(): partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5. Right now we find find and findSkip; partition would be a great complement, and can be implemented for all forward ranges. One question is naming - partition() is not good for us because std.algorithm.partition implements Hoare's in-place partition algorithm. How should we call the function? Andrei
Jan 22 2011
On Sat, 22 Jan 2011 19:44:30 +0200, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Looking through Python's string functions (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed partition(): partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5. Right now we find find and findSkip; partition would be a great complement, and can be implemented for all forward ranges. One question is naming - partition() is not good for us because std.algorithm.partition implements Hoare's in-place partition algorithm. How should we call the function? AndreisplitAt? I think "split<anything>" is much better then "partition".
Jan 22 2011
On 01/22/2011 06:44 PM, Andrei Alexandrescu wrote:Looking through Python's string functions (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed partition(): partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5. Right now we find find and findSkip; partition would be a great complement, and can be implemented for all forward ranges. One question is naming - partition() is not good for us because std.algorithm.partition implements Hoare's in-place partition algorithm. How should we call the function?separate(d) Denis _________________ vita es estrany spir.wikidot.com
Jan 22 2011
On 01/22/11 11:44, Andrei Alexandrescu wrote:Looking through Python's string functions (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed partition(): partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5. Right now we find find and findSkip; partition would be a great complement, and can be implemented for all forward ranges. One question is naming - partition() is not good for us because std.algorithm.partition implements Hoare's in-place partition algorithm. How should we call the function? AndreiBisect? -- Chris N-S
Jan 22 2011
On 1/22/11 3:33 PM, Christopher Nicholson-Sauls wrote:On 01/22/11 11:44, Andrei Alexandrescu wrote:Would be rather trisect, but that becomes a bit too cute. AndreiLooking through Python's string functions (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed partition(): partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5. Right now we find find and findSkip; partition would be a great complement, and can be implemented for all forward ranges. One question is naming - partition() is not good for us because std.algorithm.partition implements Hoare's in-place partition algorithm. How should we call the function? AndreiBisect? -- Chris N-S
Jan 22 2011
Andrei Alexandrescu:Would be rather trisect, but that becomes a bit too cute."trisect" name is acceptable :-) Bye, bearophile
Jan 22 2011
On 01/22/11 15:38, Andrei Alexandrescu wrote:On 1/22/11 3:33 PM, Christopher Nicholson-Sauls wrote:Yeah, you're right. I hit on "bi-" because my mental image was like a binary tree search. Anywho, I actually kinda like "trisect," even if it is cute. -- Chris N-SOn 01/22/11 11:44, Andrei Alexandrescu wrote:Would be rather trisect, but that becomes a bit too cute. AndreiLooking through Python's string functions (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed partition(): partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5. Right now we find find and findSkip; partition would be a great complement, and can be implemented for all forward ranges. One question is naming - partition() is not good for us because std.algorithm.partition implements Hoare's in-place partition algorithm. How should we call the function? AndreiBisect? -- Chris N-S
Jan 22 2011
Andrei Alexandrescu Wrote:Looking through Python's string functions (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed partition(): partition(sep) Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5. Right now we find find and findSkip; partition would be a great complement, and can be implemented for all forward ranges. One question is naming - partition() is not good for us because std.algorithm.partition implements Hoare's in-place partition algorithm. How should we call the function? Andreisounds like JavaScript's split: string.split(separator, limit)
Jan 22 2011
Andrei Alexandrescu napisa=B3:Looking through Python's string functions=20 (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed==20partition(): =20 partition(sep) Split the string at the first occurrence of sep, and return a=20 3-tuple containing the part before the separator, the separator itself,=20 and the part after the separator. If the separator is not found, return=20 a 3-tuple containing the string itself, followed by two empty strings.=20 New in version 2.5. =20 Right now we find find and findSkip; partition would be a great=20 complement, and can be implemented for all forward ranges. =20 One question is naming - partition() is not good for us because=20 std.algorithm.partition implements Hoare's in-place partition algorithm.==20How should we call the function?Instead of a one-shot function, would a lazy range of pre-hit-post troikas = be possible? That'd rhyme nicely with RegexMatch. In fact, match(string, st= ring) overload is free... --=20 Tomek
Jan 22 2011