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/2005-October/057163.html below:

[Python-Dev] Extending tuple unpacking

[Python-Dev] Extending tuple unpacking [Python-Dev] Extending tuple unpackingDelaney, Timothy (Tim) tdelaney at avaya.com
Tue Oct 11 00:50:39 CEST 2005
Paul Du Bois wrote:

> On 10/10/05, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>    cmd, *args = input.split()
> 
> These examples also have a reasonable implementation using list.pop(),
> albeit one that requires more typing.  On the plus side, it does not
> violate 
> DRY and is explicit about the error cases.
> 
>   args = input.split()
>   try:
>     cmd = input.pop(0)
>   except IndexError:
>     cmd = ''

I'd say you violated it right there ... (should have been)::

    args = input.split()

    try:
        cmd = arg.pop()
    except IndexError:
        cmd = ''

FWIW, I've been +1 on * unpacking since I first saw the proposal, and
have yet to see a convincing argument against it other than people
wanting to stick the * anywhere but at the end. Perhaps I'll take the
stdlib challenge (unfortunately, I have to travel this weekend, but I'll
see if I can make time).

Tim Delaney
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