Movatterモバイル変換
[0]ホーム
[Python-Dev] partition() (was: Remove str.find in 3.0?)
Raymond Hettingerraymond.hettinger at verizon.net
Tue Aug 30 03:26:35 CEST 2005
[Delaney, Timothy (Tim)]> +1>> This is very useful behaviour IMO.Thanks. It seems to be getting +1s all around.> Have the precise return values of partition() been defined? . . .> IMO the most useful (and intuitive) behaviour is to return strings in> all cases.Yes, there is a precise spec and yes it always returns three strings. Movitation and spec:http://mail.python.org/pipermail/python-dev/2005-August/055764.htmlPure python implementation, sample invocations, and tests:http://mail.python.org/pipermail/python-dev/2005-August/055764.html> My major issue is with the names - partition() doesn't sound right to> me.FWIW, I am VERY happy with the name partition(). It has a long anddelightful history in conjunction with the quicksort algorithm where itdoes something very similar to what we're doing here: partitioning datainto three groups (left,center,right) with a small center element(called a pivot in the quicksort context and called a separator in ourstring parsing context). This name has enjoyed great descriptivesuccess in communicating that the total data size is unchanged and thatthe parts can be recombined to the whole. IOW, it is exactly the rightword. I won't part with it easily.http://www.google.com/search?q=quicksort+partitionRaymond
More information about the Python-Devmailing list
[8]ページ先頭