[Python-Dev] [Python-checkins] whatever happened to string.partition ?

Guido van Rossum guido at python.org
Fri May 26 03:38:02 CEST 2006


On 5/25/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> Raymond Hettinger wrote:
>> > IIRC, Skip had developed a smart version that returned lazy string
> > objects that kept a reference and pointers to the original string
> > (instead of making its own copy of the string components). The string
> > subclass would expand itself and free the reference if necessary for a
> > subsequent string operation. The main purpose was to handle the cases
> > where one fragment of the other was never used or just had a length
> > check. Also it was helpful when partition was used lisp-style to
> > repeatedly break-off head/tail fragments.
>> that sounds nice in theory, but I completely fail to see how that can be
> implemented without ripping out the existing string object and replacing
> it with something entirely different, or (via horrible macro tricks)
> slow down virtually all other use of PyStringObject.
>> skip? was this a real design or a Py3K bluesky idea?

I suggest to forget about that particular idea and just do what you
were thinking of originally. str.partition() and unicode.partition()
should be as simple as possible, to cover the 80% use case FAST.
-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /