Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
NeutralForest
10 months ago
|
parent
|
context
|
favorite
| on:
Pyrefly - A faster Python type checker written in ...
For maximum safety, I would write:
if bar.get("baz", {}).get("qux") is not None: ...
nikisweeting
10 months ago
[–]
any more than 2 levels deep of this pattern and I reach for python-benedict
NeutralForest
10 months ago
|
parent
[–]
Nice, I didn't know about that lib! Usually if I have very nested content I recursively parse it and I'll have some business logic in the function to handle cases here and there. Or I'll have a validation library like Pydantic.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: