Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named context arguments #95

Open
dag opened this issue Apr 18, 2011 · 0 comments
Open

Named context arguments #95

dag opened this issue Apr 18, 2011 · 0 comments
Labels
Milestone

Comments

@dag
Copy link
Owner

dag commented Apr 18, 2011

Perhaps keyword arguments would be better than positional arguments. That is: have contexts yield dictionaries, and pass by key name rather than position. This might not be backwards-compatible without some switch.

@web.context
def appcontext():
    yield dict(app=app, templates=templates)

@web.test
def index(templates):
    assert len(templates) == 1

Currently the above would treat the dict as a single, positional argument. If we had yielded a two-tuple, the test would receive the app as 'templates'. The benefit of this idea is that we can easily "skip" arguments. Downsides would be the need to name argument and the possibility of name conflicts (however unlikely).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant