Lambda returning tuple question, multi-expression

aapost aapost at idontexist.club
Thu Mar 9 17:55:01 EST 2023


On 3/9/23 16:37, Cameron Simpson wrote:
> On 09Mar2023 09:06, Alan Gauld <learn2program at gmail.com> wrote:

> Just a note that some code formatters use a trailing comma on the last 
> element to make the commas fold points. Both yapf (my preference) and 
> black let you write a line like (and, indeed, flatten if short enough):
> 
>      ( a, b, c )
> 
> but if you write:
> 
>      ( a, b, c, )
> 
> they'll fold the lines like:
> 
>      ( a,
>        b,
>        c,
>      )
> Cameron Simpson <cs at cskk.id.au>


Thanks for the info, good to know, I actually do like the idea of 
trailing commas for tuples (helps prevent things like the difference 
between ("abc") and ("abc",) and makes swapping things around nicer.

I've just been using a lot of json lately and it has been subconsciously 
training me different, lol.


More information about the Python-list mailing list