First page Back Continue Last page Overview Image

Zusammensetzung von CMs

from contextlib import contextmanager

@contextmanager

def tag(name):

print("<%s>" % name)

yield

print("</%s>" % name)

with tag("body") as r:

with tag("p") as s:

print("Some text!")

# äquivalent mit

with tag("body") as r, tag("p") as s:

print("Just some text!")