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

Allow invoking of to_dict (and others) on default sget arguments #19

Open
rszalski opened this issue Sep 9, 2015 · 0 comments
Open

Comments

@rszalski
Copy link
Contributor

rszalski commented Sep 9, 2015

The common pattern I see is:

if reply.sth:
    return reply.sth.to_dict()
return {}

It would be nice if sget() supported returning of default argument on which you could still invoke to_dict():

return reply.sget('sth', {}).to_dict()

But this might be tricky to implement, since default argument gets returned as is. In this case, Pythons dict do not support to_dict().
Alternative would be to specify helper methods directly in the sget() string:

return reply.sget('sth.to_dict()', {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant