Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Python 3.11: “Zero cost” exception handling. Parent comment
And if you care about the default value being a particular type, when there may also be None in the input stream, do something like:
x.get("key") or []
or
str(x.get("key") or "") # Guarantee strings and avoid "None"!
There are no comments on this comment yet.
And if you care about the default value being a particular type, when there may also be None in the input stream, do something like:
x.get("key") or []
or
str(x.get("key") or "") # Guarantee strings and avoid "None"!