[Python-Dev] C-level duck typing (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Wed May 16 20:33:28 CEST 2012


Does this use case make sense to everyone?

The reason why we are discussing this on python-dev is that we are looking for a general way to expose these C level signatures within the Python ecosystem. And Dag's idea was to expose them as part of the type object, basically as an addition to the current Python level tpcall() slot.

The use case makes sense, yet there is also a long-standing solution already to expose APIs and function pointers: the capsule objects.

If you want to avoid dictionary lookups on the server side, implement tp_getattro, comparing addresses of interned strings.

Regards, Martin



More information about the Python-Dev mailing list