[Python-Dev] Re: [Python-Dev] RE: [Python-Dev] String methods... finally
Ka-Ping Yee
ping at lfw.org
Tue Jun 15 09:24:33 CEST 1999
On Mon, 14 Jun 1999, Tim Peters wrote:
>
> A bug:
>
> >>> 'ab'.endswith('b',0,1) # right
> 0
> >>> 'ab'.endswith('ab',0,1) # wrong
> 1
> >>> 'ab'.endswith('ab',0,0) # wrong
> 1
> >>>
I assumed you meant that the extra arguments should be slices
on the string being searched, i.e.
specimen.startswith(text, start, end)
is equivalent to
specimen[start:end].startswith(text)
without the overhead of slicing the specimen? Or did i understand
you correctly?
> Return a string which is the concatenation of the string representation
> of very element in the sequence. The separator between elements is S.
> >>>
>
> "-".join("very nice indeed! ly".split()) + " y'rs - tim"
Yes, i have to agree that this (especially once you name the
separator string) is a pretty nice way to present the "join"
functionality.
!ping
"Is it so small a thing,
To have enjoyed the sun,
To have lived light in the Spring,
To have loved, to have thought, to have done;
To have advanced true friends, and beat down baffling foes--
That we must feign bliss
Of a doubtful future date,
And while we dream on this,
Lose all our present state,
And relegate to worlds... yet distant our repose?"
-- Matthew Arnold
More information about the Python-Dev
mailing list