Currently, objects_to_bbox and friends require a list as input, but there's no reason they couldn't work equally well with generator expressions, iterators, or anything else iterable.
Well, actually there is a reason, which is that they are written such that they iterate repeatedly over their input for each attribute (and thus can't reuse the same iterable), but this doesn't have to be the case, for instance, merge_bboxes could be written as:
Currently,
objects_to_bbox
and friends require a list as input, but there's no reason they couldn't work equally well with generator expressions, iterators, or anything else iterable.Well, actually there is a reason, which is that they are written such that they iterate repeatedly over their input for each attribute (and thus can't reuse the same iterable), but this doesn't have to be the case, for instance,
merge_bboxes
could be written as:It's also a bit faster (note that there is no need to wrap the
map
in alist
):I can supply a PR :)