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

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

[Python-Dev] syntactic shortcut - unpack to variably sized listNick Coghlan ncoghlan at gmail.com
Mon Nov 15 14:41:59 CET 2004
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 at email.com  | Mobile: +61 409 573 268
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