Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Proof of the pudding: str.partition()

Jim Jewettjimjjewett at gmail.com
Wed Aug 31 20:56:44 CEST 2005


Michael Chermside wrote (but I reordered):>Simplicity and elegence are two of the reasons that this> is such an excellent proposal, let's not lose them.> Raymond's original definition for partition() did NOT support> any of the following:>   (*) Regular ExpressionsWhile this is obviously more powerful, and an analogue shouldprobably go in re ... it doesn't belong in strings.  I don't want tohave to explain why    "www.python.org".part('.') acts strangely (forget to escape the period).>   (*) Ways to generate just 1 or 2 of the 3 values if some are>       not going to be used>   (*) Clever use of indices to avoid copying strings>   (*) Behind-the-scenes tricks to allow repeated re-partitioning>       to be faster than O(n^2)I think these may be useful behind the scenes, but the API shouldnot expose them unless they are made more general.For instance, the compiler could recognize that junk variables (orvariable names matching a certain pattern?) don't really have to be created -- and that would be useful for more than string splitting.Doing it as a special case here just leads to a backwards compatibilitywart later.-jJ


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp