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.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/5CPS5VLB3VZPGOJ3GSA4V7BOGUBM5LIH/
Code of Conduct: http://python.org/psf/codeofconduct/