On Wed, 23 Feb 2022 at 15:04, Dan Stromberg <drsali...@gmail.com> wrote: > > On Tue, Feb 22, 2022 at 7:46 AM David Raymond <david.raym...@tomtom.com> > wrote: > > > > Is there a simpler way? > > > > >>> d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']} > > >>> [a for b in d.values() for a in b] > > ['aaa', 'bbb', 'ccc', 'fff', 'ggg'] > > >>> > > > > I like that way best. > > But I'd still: > 1) use a little more descriptive identifiers > 2) put it in a function with a descriptive name > 3) give the function a decent docstring
If you're going to do that, then you may as well use list(chain()) and let the work be done in C. ChrisA -- https://mail.python.org/mailman/listinfo/python-list