[Python-ideas] Default return values to int and float
Ron Adam
ron3200 at gmail.com
Thu Oct 6 19:42:34 CEST 2011
On Thu, 2011-10-06 at 17:47 +0200, Jan Kaliszewski wrote:
> A lightweight builtin type whose instances would have `index`
> attribute might do the job well (together with None as not-found).
>
> A naive pure-Python implementation:
>
> class Found(object):
> __slots__ = 'index',
> def __init__(self, index):
> self.index = index
> ...
> found = s.search(one_of)
> ...
It seems to me, the methods on the string object should be the lower
level fast C methods that allow for efficient higher level functions to
be built.
A search class may be a good addition to string.py. It already has
higher order stuff for composing strings, format and template, but
nothing for decomposing strings.
Cheers,
Ron
More information about the Python-ideas
mailing list