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

Nick Coghlan ncoghlan at gmail.com
Wed May 16 10:11:08 CEST 2012


Use PyObject_HasAttr, just as people use hasattr() for ducktyping in Python.

If you want something more structured, use Abstract Base Classes, that's what they're for.

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list