i also thought i'm not understanding something (some clever design? dict+next update withou replacing?) - but no...it is just wrong usage of an iterator
In [14]: a = [{'a': 'bb'}, {'b': 'cc'}]
In [15]: r.update({'adsdata': next(x for x in a)})
In [16]: a.pop()
Out[16]: {'b': 'cc'}
In [17]: r.update({'adsdata': next(x for x in a)})
In [18]: r
Out[18]: {'adsdata': {'a': 'bb'}}
this is a weird code, next() on a list which is created everytime https://github.com/adsabs/ADSimportpipeline/blob/master/lib/SolrUpdater.py#L710
it is quadratic and therefore slow
i also thought i'm not understanding something (some clever design? dict+next update withou replacing?) - but no...it is just wrong usage of an iterator