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 | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com