bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zsh style associative array assignment bug


From: Andreas Schwab
Subject: Re: zsh style associative array assignment bug
Date: Mon, 29 Mar 2021 09:47:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

On Mär 28 2021, Greg Wooledge wrote:

> Python is different:
>
>>>> y = ["a", "b", "c", "d"]
>>>> dict(zip(y[::2], y[1::2]))
> {'a': 'b', 'c': 'd'}
>>>> x = ["a", "b", "c"]
>>>> dict(zip(x[::2], x[1::2]))
> {'a': 'b'}
>
> It seems to discard the last (unmatched) value.

>>> dict(zip_longest(x[::2], x[1::2]))
{'a': 'b', 'c': None}

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]