Skip to content

Add @coroutine decorator to Coroutines #112

@ghost

Description

After reading through the presentation by David Beazley (the link at the bottom of your coroutines page), I noticed he wrote a nice decorator to help set up a coroutine. It looks like this:

def coroutine(func):
    def start(*args,**kwargs):
        cr = func(*args,**kwargs)
        cr.next()
        return cr
    return start

@coroutine
def grep(pattern):
    ...

You may want to add in reasons why people would use coroutines. For example, as part of a pipeline or filter. Slides 2-23 of David Beazley's presentation may be useful to help with examples and explanations.

I'd be interested to see what other uses for coroutines you find, especially since this is the first time I've seen them in Python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions