[Python-Dev] Fwd: Problem withthe API for str.rpartition() (original) (raw)
Jim Jewett jimjjewett at gmail.com
Tue Sep 5 18:08:19 CEST 2006
- Previous message: [Python-Dev] Signals, threads, blocking C functions
- Next message: [Python-Dev] Fwd: Problem withthe API for str.rpartition()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Reversing the order of the return tuple will break the alignment with split/rsplit.
Why not just change which of the three strings holds the remainder in the not-found case?
In rc1,
"d".rpartition(".") --> ('d', '', '')
If that changes to
"d".rpartition(".") --> ('', '', 'd')
then (1) the loop will terminate (2) rpartition will be more parallel to partition (and split), (3) people who used rpartition without looping to termination (and therefore didn't catch the problem) will still be able to use their existing working code. (4) the existing docstring would remain correct, though it could still be improved. (It says "returns S and two empty strings", but doesn't specify the order.)
-jJ
- Previous message: [Python-Dev] Signals, threads, blocking C functions
- Next message: [Python-Dev] Fwd: Problem withthe API for str.rpartition()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]