News for hackers. Stuff that matters.
Re:What's New in Python 3.12 by kh_hk on Wednesday October 18, 2023 @02:27PM (#37932668)

    >>> foo = {"foo": None}
    >>> print(foo.get('foo', {}).get('bar'))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'NoneType' object has no attribute 'get'
    >>> print((foo.get('foo') or {}).get('bar'))
    None
Re:What's New in Python 3.12 by ddejohn on Wednesday October 18, 2023 @02:33PM (#37932751)
Right, see my other comment:

> Blowing up on `None` is an easy short-circuit.

The thing being discussed is attempting to access deeply nested values, so short-circuiting here is a win-win. I.e., you wouldn't want to unnecessarily traverse tons of empty dictionaries using the `.get() or {}` trick.