Package cherrypy :: Package tutorial :: Module tut08_generators_and_yield
[hide private]
[frames] | no frames]

Module tut08_generators_and_yield

source code

Bonus Tutorial: Using generators to return result bodies

Instead of returning a complete result string, you can use the yield statement to return one result part after another. This may be convenient in situations where using a template package like CherryPy or Cheetah would be overkill, and messy string concatenation too uncool. ;-)

Classes [hide private]
  GeneratorDemo
Variables [hide private]
  __package__ = 'cherrypy.tutorial'