Boost.Python has two smart-pointer-like classes for holding PyObject*. "handle<>" is more or less a customized intrusive_ptr, with the ability to be templated on other PyObject "derived" types (like PyTypeObject). The "object" hierarchy provides a much higher-level API, and defaults to Python's None rather than a null pointer.

In terms of actual usage, I see:

- "object" is widely used in the public Boost.Python API, and is extremely useful there.

- "handle<>" is rarely used except as a bridge to create object from PyObject*. The internal API tends to use raw PyObject* instead.

 - "handle<>" is almost never used with a non-default template parameter.

Is there any reason why the internal API uses raw PyObject* instead of handle<>?

If not, I'm inclined to start using handle<> there (or even object, for features that have become widely used like rvalue-converters).

And since handle<> is almost never used as a template, I'm inclined to make it a regular class - or even just a typedef of intrusive_ptr<PyObject>.

Any thoughts?

Jim
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to