%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/doc/python3-rich/examples/
Upload File :
Create Path :
Current File : //usr/share/doc/python3-rich/examples/repr.py

import rich.repr


@rich.repr.auto
class Bird:
    def __init__(self, name, eats=None, fly=True, extinct=False):
        self.name = name
        self.eats = list(eats) if eats else []
        self.fly = fly
        self.extinct = extinct


# Note that the repr is still generated without Rich
# Try commenting out the following line

from rich import print

BIRDS = {
    "gull": Bird("gull", eats=["fish", "chips", "ice cream", "sausage rolls"]),
    "penguin": Bird("penguin", eats=["fish"], fly=False),
    "dodo": Bird("dodo", eats=["fruit"], fly=False, extinct=True),
}
print(BIRDS)

Zerion Mini Shell 1.0