Movatterモバイル変換
[0]ホーム
[Python-Dev] Alternative name for str.partition()
Jim Jewettjimjjewett at gmail.com
Wed Aug 31 20:43:02 CEST 2005
[Inhttp://mail.python.org/pipermail/python-dev/2005-August/055880.html ]Andrew Durdin wrote:> one of the "fixed stdlib" examples that Raymond> posted actually uses rpartition and partition in two consecutive linesEven with that leadin, even right next to each other, it took me a bit oftime to see the difference between rest.rpartition and rest.partition.> rest, _, query = rest.rpartition('?')> script, _, rest = rest.partition('/')Shortening the names helps, because a single letter matters more.> rest, _, query = rest.rpart('?')> script, _, rest = rest.part('/')A different-looking word (such as Greg's suggestion) might be evenbetter, if the word also works on its own.> rest, _, query = rest.rsplit_at('?')> script, _, rest = rest.split_at('/') -jJ
More information about the Python-Devmailing list
[8]ページ先頭