[Python-ideas] string codes & substring equality
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Nov 29 05:57:26 CET 2013
Steven D'Aprano wrote:
> On Thu, Nov 28, 2013 at 12:43:05PM +0100, spir wrote:
>
>>Is it weird to consider a .code(i) string method?
>
> Such a method should not be called "code", since "ordinal" or "ord" is
> the accepted term for it.
How about giving ord() an optional index parameter?
ord(s, i)
would be equivalent to
ord(s[i])
but would avoid creating an intermediate string
object.
--
Greg
More information about the Python-ideas
mailing list