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/049904.html below:

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

[Python-Dev] syntactic shortcut - unpack to variably sized list [Python-Dev] syntactic shortcut - unpack to variably sized listJohan Hahn johahn2003 at home.se
Sat Nov 13 14:16:41 CET 2004
Martin v. Löwis wrote:
> Nick Coghlan wrote:
> > x = L[i:i+n]; del L[i:i+n]; return x
> > 
> > By default, n = 1, so the standard behaviour of list.pop is preserved.
> 
> This default would actually change the standard behaviour: whereas it
> now returns a single element, it would then return a list containing
> the single element.

Too bad.
I would have liked list.pop(i, n=1, step=1) to be the same as 

x = L[i:i+n:step]; del L[i:i+n:step]; return x

Having pop()/pop(i) return an element and pop(i, n)/pop(i, n, step) return a 
list is a no-no, or is it?

...johahn
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