[Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
Nick Coghlan
ncoghlan at gmail.com
Wed Dec 6 13:26:05 CET 2006
More information about the Python-Dev mailing list
Wed Dec 6 13:26:05 CET 2006
- Previous message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Next message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fredrik Lundh wrote: > the problem with slicing is that people may 1) expect a slice to return > a new object *of the same type* (which opens up a *gigantic* can of > worms, both on the implementation level and on the wtf-is-this-thing- > really level), and 2) expect things like [::-1] to work, which opens up > another can of worms. I prefer the "If the implementation is easy to > explain, it may be a good idea." design principle over "can of worms" > design principle. This is a good point - I know I consider "m[0:0] == type(m)()" to be a property a well-behaved sequence should preserve. Since match objects can't really do that, better not to pretend to be a sequence at all. With slicing out of the equation, that only leaves the question of whether or not len(m) should work. I believe it would be nice for len(m) to be supported, so that reversed(m) works along with iter(m). Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
- Previous message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Next message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list