Sven R. Kunze 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() != "")
> Friend of mine told me something like this: > > String.Join("\n", mylist.Where(foo => > !String.IsNullOrEmpty(foo.description)).Select(foo => foo.description)) I don't know if is "better" or not, but I find more readable using the "sql"-like syntax string.Join("\n", from foo in mylist where !string.IsNullOrEmpty(foo.description()) select foo.description()); which is relatively similar to the python's comprehension. -- By ZeD -- https://mail.python.org/mailman/listinfo/python-list