-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
This kind of bothers me
@to_object()
@from_object()
class Foo(object):
passThe decorators are separate because each accepts arguments that modify the encode/decode behavior of the object. Stil, there is something about the above code I dislike. So how about something like this
@jsonable
class Foo(object):
passjsonable accepts no arguments. If you want to pass arguments then you must still use from_object and to_object. Essentially jsonable becomes a short cut for the first example. Its implementation being quite simple
def jsonable(cls):
to_object()(cls)
from_object()(cls)Is this use case common enough to warrant the additional of jsonable?
Reactions are currently unavailable