data = json.load(sys.stdin)
commits = [
e["commit"]
for e in data
if e["commit"]["author"] == "Tom Hudson"
]
json.dump(commits, sys.stdout) data = json.load(sys.stdin)
commits = [
e["commit"]
for e in data
if e["commit"]["author"] == "Tom Hudson"
]
json.dump(commits, sys.stdout)P.S. `some.get("A", {})["B"]` is bad programming habit because there might be a list on `some["A"]`
jello '[e.commit for e in _ if e.commit.author == "Tom Hudson"]'
Jello let’s you use python syntax with dot notation without the stdin/stdout/json.loads boilerplate.Has nothing to do with arrays, it has to do with the fact that Python dicts with string indexes and Python objects with properties are different things, unlike JS where member and index access are just different ways of accessing object properties.
> Or maybe I'm spoiled from using typed languages and cannot see the ingenuity of the python/javascript/other-untyped-hyped-lang api authors that it solves?
This isn't an untyped thing, this is a JavaScript (and thus JSON) and Python have type systems (even if they usually don't statically declare them) and those type systems and thus the syntax around objects are different between the two.