Skip to content

Document guidelines for when to use dynamically typed APIs #1127

@erlend-aasland

Description

@erlend-aasland

We need to agree on guidelines for when to use and when to not use dynamically typed APIs.

See capi-workgroup/problems#31 (The C API is weakly typed)

In capi-workgroup/problems#31 (comment), @markshannon suggests:

PyObject *obj, PyDictObject *dict;
PyObject_GetItem(obj);   // 👍 
PyDict_GetItem(dict);   // 👍 
PyObject_GetItem((PyObject *)dict); // Pointlessly inefficient
PyDict_GetItem((PyDictObject *)obj); // Unsafe

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions