Martin v. Löwis wrote:
Armin Rigo wrote:
Of course, whoever implements the change should make sure that slices are applicable consistently everwhere the documentation says they should be.
Random thought: the two uses of "[" and "]" in the sequence docs can get a little confusing. . . or maybe I'm just tired ;) Anyway, the sequence and mutable sequence sections of the documentation don't reveal anything other than list.pop(). It seems to be the only normal method that accepts an index as an argument. Everything else looks to be dealt with via standard subscripts and the associated magic methods: Retrieval: x = L[i] | x = L.__getitem__(i) Setting: L[i] = x | L.__setitem__(i, x) Deletion: del L[i] | L.__delitem__(i, x) So it looks like list.pop simply got left out because it wasn't a magic method, and the idea of permitting extended slicing for it just didn't come up (well, until now).** Anyway, if this is implemented, array.pop and UserList.pop should allow slices, too, as they are described as working like list.pop. The other container classes I've checked are either immutable, or don't allow indexed access beyond the basics (string, unicode, set, deque). Cheers, Nick. ** Some items of possible historical interest: http://www.python.org/doc/2.3.4/whatsnew/section-slices.html http://sourceforge.net/tracker/?group_id=5470&atid=305470&aid=400998&func=detail http://mail.python.org/pipermail/python-dev/2002-May/023874.html -- Nick Coghlan | Brisbane, Australia Email: ncoghlan@email.com | Mobile: +61 409 573 268