6 Dec
2019
6 Dec
'19
1:48 p.m.
06.12.19 00:09, Ethan Furman пише:
I haven't followed the main thread, but I can unequivocally state that for-loop version is easier to read.
I completely agree.
The only thing missing to make the intent crystal clear is one more word in the function name:
def get_first_product_item(...):
It is likely there is only one dict with the key '@type' equal to 'Product' in the jsonld_items list. The structure of the data can be validated before or we just trust the source. So the name get_product_item() is correct. The rest is an implementation detail.