A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-October/057127.html below:

[Python-Dev] Extending tuple unpacking

[Python-Dev] Extending tuple unpackingGreg Ewing greg.ewing at canterbury.ac.nz
Mon Oct 10 04:44:12 CEST 2005
Guido van Rossum wrote:

> I personally think this is adequately handled by writing:
> 
>   (first, second), rest = something[:2], something[2:]

That's less than satisfying because it violates DRY
three times (once for mentioning 'something' twice,
once for mentioning the index twice, and once for
needing to make sure the index agrees with the number
of items on the LHS).

> Argument lists are not tuples [*] and features of argument lists
> should not be confused with features of tuple unpackings.

I'm aware of the differences, but I still see a strong
similarity where this particular feature is concerned.
The pattern of thinking is the same: "I want to deal
with the first n of these things individually, and the
rest collectively."

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+
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