How do I turn this into a one line generator?
My best attempts have failed:
for s in self.services:
for m in s.messag开发者_如何学运维es: yield m
(m for s in self.services for m in s.messages)
... as counter-intuitive as it seems.
itertools.chain.from_iterable(s.messages for s in self.services)
精彩评论