Skip to content

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

@rszalski

Description

@rszalski

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()', {})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions