Closed
Description
If I have a Python dictionary object or similar:
julia> d = pyeval("{'foo': 1, 'bar': 2}", Main)
Python dict: {'foo': 1, 'bar': 2}
it would be nice to be able to use haskey(d, x)
(by checking whether PyObject_GetItem
returns NULL
), get(d, x, default)
(similar to this), etcetera.
Maybe call it pyhasitem
if you don't want to overload haskey
. You already have a 2-arg pygetitem
, so you could add a 3-arg version instead of overloading get
. (Though I'm not sure what's wrong with overloading haskey
and get
, since you already overload getindex
.)
Metadata
Metadata
Assignees
Labels
No labels