How to imporve D-translation of these Python list comprehensions ?

Igor Shirkalin mathsoft at inbox.ru
Mon Jan 15 20:27:12 UTC 2018


On Monday, 15 January 2018 at 19:05:52 UTC, xenon325 wrote:
> A workmate has recently shown this piece of code to show how 
> nice Python is (we are mostly C and growing C++ shop):
>     dd = [dict(_name=k, **{a + str(i): aget(d, k, a) for a in 
> aa for i, d in enumerate([srv1, srv2])}) for k in sorted(kk)]

This is the most terrible Python code I have ever seen.
If you know Python, could you please unroll to more readable form?

> Suggestion are welcome!

>
> ---
> Alexander




More information about the Digitalmars-d-learn mailing list