[Python-Dev] PEP 567 pre v3 (original) (raw)
Nathaniel Smith njs at pobox.com
Mon Jan 8 18:02:50 EST 2018
- Previous message (by thread): [Python-Dev] PEP 567 pre v3
- Next message (by thread): [Python-Dev] PEP 567 pre v3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jan 8, 2018 at 2:35 PM, Victor Stinner <victor.stinner at gmail.com> wrote:
ctx[var] raises an exception but ctx.get(var) returns None in such case. My point is just that Context.get() behaves differently than dict.get(). If dict[key] raises, I expect that dict.get() raises too and that I have to write explicitely dict.get(default=None).
But that's not how dict.get works?
In [1]: d = {}
In [2]: print(d.get(1)) None
-n
-- Nathaniel J. Smith -- https://vorpus.org
- Previous message (by thread): [Python-Dev] PEP 567 pre v3
- Next message (by thread): [Python-Dev] PEP 567 pre v3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]