On 29.03.2016 12:18, Sven R. Kunze wrote:
On 29.03.2016 11:39, Peter Otten wrote:
My question to those who know a bit of C#: what is the state-of-the-art
equivalent to

"\n".join(foo.description() for foo in mylist
                          if foo.description() != "")


Using LINQ, I suppose: https://en.wikipedia.org/wiki/Language_Integrated_Query

Friend of mine told me something like this:

String.Join("\n", mylist.Where(foo => !String.IsNullOrEmpty(foo.description)).Select(foo => foo.description))

[untested, but from what I know of quite correct]

Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to