summaryrefslogtreecommitdiff
path: root/doc/data/messages/i/init-is-generator/good.py
blob: 483cd46c18e56b3e72228b0df72175e497f0e808 (plain)
1
2
3
4
5
6
7
8
9
10
class Fruit:
    def __init__(self, worms):
        self.__worms = worms

    def worms(self):
        yield from self.__worms

apple = Fruit(["Fahad", "Anisha", "Tabatha"])
for worm in apple.worms():
    pass