Skip to content

Keying function #4

Description

@mikeboers

It could be nice to be able to provide a function that returns the specific key to use much like etagger does:

def keyer(*args, **kwargs):
    id_ = kwargs.get('id')
    if id_ is not None:
        return id_
    else:
        raise NotImplementedError()

@memo(keyer=keyer)
def render_blog_post(content, **kwargs):
    # Some expensive process to render latex, Markdown, etc.
    pass

# ...

render_blog_post(post.body, id=post.id)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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