https://prefect.io logo
Title
t

Tim Enders

08/18/2022, 8:20 PM
What replaces the old
flatten
call in Prefect 2.0? I have a list of lists after mapping tasks and I used to be able to use
flatten
to coalesce that into a single large list.
👀 1
t

Timo

09/05/2022, 9:44 AM
interessted in this to... currently i do it by myself...but would be great if there will be something out of the box
flatten_files = [
        file
        for unzipped_file in unzipped_files
        for file in unzipped_file.wait().result()
    ]
1
a

Anna Geller

09/05/2022, 3:29 PM
I think Timos approach seems like the right approach. Given that you can run any Python now, flatten is no longer really required but if you want to, you can open a feature request on GitHub and describe why doing it in Python without extra abstraction doesn't work for you and what the proposed alternative would look like. It would be better to not think how this is tackled in 1.0 but rather what you think the right solution would look like if you wouldn't know 1.0 before. Thanks in advance