[Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

Michael Urman murman at gmail.com
Thu Dec 7 15:28:30 CET 2006


On 12/7/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> (and while you guys are waiting, I suggest you start a new thread where
> you discuss some other inconsistency that would be easy to solve with
> more code in the interpreter, like why "-", "/", and "**" doesn't work
> for strings, lists don't have a "copy" method, sets and lists have
> different API:s for adding things, we have hex() and oct() but no bin(),
> str.translate and unicode.translate take different arguments, etc.  get
> to work!)

Personally I'd love a way to get an unbound method that handles either
str or unicode instances. Perhaps py3k's unicode realignment will
effectively give me that.

(And agreed on there being no reason that supporting indexing requires
supporting slicing.  But also agreed that match slicing could be as
useful as indexing. Really I don't use regexps enough in Python to
have a position; I was more interested in figuring out where the
type(m) == type(m[:]) idea had come from, as I had never formed it.)
-- 
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-Dev mailing list