marshmallow icon indicating copy to clipboard operation
marshmallow copied to clipboard

allow for overriding dump’s iteration behavior

Open mochic opened this issue 7 years ago • 0 comments

Currently at: https://github.com/marshmallow-code/marshmallow/blob/1781e9a18895aa9b473fb5587de3cf922416733e/marshmallow/schema.py#L396-L397 iteration behavior is determined by list(). Would it be considered a useful feature to be able to override this behavior with a function that takes the object and returns an iterator? (similar to the way _serializer can be overriden)

def _dumper(obj):
    return (i for i in obj)

mochic avatar May 08 '18 04:05 mochic