News for hackers. Stuff that matters.
Re:Pyrefly by NeutralForest on Tuesday April 29, 2025 @03:43PM (#43837136)
For maximum safety, I would write:

    if bar.get("baz", {}).get("qux") is not None:
    ...
Re:Pyrefly by nikisweeting on Tuesday April 29, 2025 @08:06PM (#43839584)
any more than 2 levels deep of this pattern and I reach for python-benedict
Re:Pyrefly by NeutralForest on Wednesday April 30, 2025 @02:32AM (#43841887)
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.