One-liner to merge lists?

Chris Angelico rosuav at gmail.com
Sun Feb 27 01:18:40 EST 2022


On Sun, 27 Feb 2022 at 16:35, Dan Stromberg <drsalists at gmail.com> wrote:
>
>
> On Fri, Feb 25, 2022 at 3:15 PM Chris Angelico <rosuav at gmail.com> wrote:
>>
>> But ultimately, that's still the same as sum(), and it's no more
>> readable than chain(), so I'd still be inclined to go with chain and
>> then wrap it in a function if you need the clarity.
>
>
> "Need" the clarity?  Please tell me you don't think clarity is for the feeble minded.
>

It's more about whether you consider that list(chain(...)) is a clear
and readable idiom, or you prefer to give a name to it. Not every
two-operation action needs its own name.

ChrisA


More information about the Python-list mailing list