[C++-sig] Re: Re: Boost.Python v2: object facilities updated

David Abrahams david.abrahams at rcn.com
Thu Jun 20 04:43:26 CEST 2002


From: "Dave Hawkes" <daveh at cadlink.com>

> > In theory it's not, but I could really use some help with that stuff.
Do
> > you think you might take on the job of fleshing out the missing pieces?
> > It's fairly mechanical, mostly, but requires some attention. My idea
was
> to
> > follow the Python/C API documentation and make files like
> > object_protocol.hpp which mirror pages like
> > http://www.python.org/dev/doc/devel/api/object.html. Of course, many
> > functions are covered by the operators already defined, so we don't
need
> > separate functions for those. The idea is just to cover the built-in
> > functions (http://www.python.org/dev/doc/devel/lib/built-in-funcs.html)
> and
> > any 'C' API functions which aren't otherwise handled.
> >
>
> I have a number of ideas for an aproach to this,

Not to thwart creativity, but I hope you're not thinking of anything too
fancy. It does seem like a fairly mechanical job to me...

> but I want to try a couple
> of things before I post here. Once I'm clear what's involved I can let
you
> know if I can do this, plus some timescales.

Thanks, I really appreciate your contributions.

> An issue I keep having with 'object' is the lack of a default
constructor. I
> think this may have been discussed before, but I can't remember the
outcome.

You can always search
http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/c++-sig...

> What is the reason for not creating a Py_None object with the default
> constructor?

No direct analogue in Python. But that's not neccessarily a good reason.
Wouldn't it be better to have a None object, though?

    object x = None;

> With all its extra functionality now it can be used for much
> more than just capturing return values. It is occasionally useful to
declare
> an object and defer its actual assignment.

Sure. I'll add the default constructor if there's a good reason to, but I
don't see one yet.






More information about the Cplusplus-sig mailing list