On 11 April 2018 at 13:23, Clint Hepner <clint.hep...@gmail.com> wrote:
>>    # Even complex expressions can be built up piece by piece
>>    y = ((eggs := spam()), (cheese := eggs.method()), cheese[eggs])

> I find the assignments make it difficult to pick out what the final 
> expression looks like.
> The first isn't too bad, but it took me a moment to figure out what y was. 
> Quick: is it
>   * (a, b, c)
>   * (a, (b, c))
>   * ((a, b), c)
>   * something else
> First I though it was (a, b, c), then I thought it was actually ((a, b), c), 
> before
> carefully counting the parentheses showed that I was right the first time.

This is a reasonable concern, IMO. But it comes solidly under the
frequently raised objection "This could be used to create ugly code!".
Writing it as

y = (
    (eggs := spam()),
    (cheese := eggs.method()),

makes it obvious what the structure is.

Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to