A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-November/049934.html below:

[Python-Dev] syntactic shortcut - unpack to variably sized list

[Python-Dev] syntactic shortcut - unpack to variably sized list"Martin v. Löwis" martin at v.loewis.de
Mon Nov 15 22:34:23 CET 2004
Nick Coghlan wrote:
> 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. 

This isn't really true:

s.index(x[, i[, j]])  	
    return smallest k such that s[k] == x and i <= k < j  	
s.insert(i, x)  	
    same as s[i:i] = [x]

However, I don't think this naturally extends to slices:
for index, there is no <= relationship for slices (atleast
not a natural one), and for insert, you can use slices as
start- and end-index of a slice.

> Anyway, if this is implemented, array.pop and UserList.pop should allow 
> slices, too, as they are described as working like list.pop.

Right. For UserList, it probably falls out naturally.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4