Re: [pygccxml-development] [FT] recent changes - generated code
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-09-21 10:51:40
|
On 9/21/06, Matthias Baas <ba...@ir...> wrote: > Roman Yakovenko wrote: > > 1. Boost.Python object.hpp defines "len" function. > > This will impove next code: > > > > if (v.attr("__len__")()!=3) > > Can you point me to the documentation of this function? At least in > v1.33.1 it's not a member function of the object class. The following > didn't work: > > if (v.len()!=3) boost::python::len, it it defined in boost/python/object.hpp > > I know we are talking about code generator, but may be we can introduce few > > convinience functions? > > > > namespace pyplusplus{ namespace convinience{ > > void raise_error( exception, message ){ > > PyErr_SetString(exception, message); > > boost::python::throw_error_already_set(); > > } > > } } > > What shall I call the file in the code repository? convenience.py? I think yes. Although you can suggest another name > > It is obvious to me that we have to have hear "ensure_sequence" function > > > > template< class ItemType=any > > > void ensure_sequence( PyObject* x, Py_ssize_t expected_size=-1 ) { > > if not sequence: raise > > if does not have desired length raise > > if items in sequence are not from desired type raise > > } > > I suppose this is also a candidate for the pyplusplus::convenience > namespace, right? Do you want me to put this into a separate file or can > I add it to the above convenience file? I think we can put it in the same "convinience.py" file. Also in future we can move the functionality in another( may be better may be more specific ) namespace/file. > > P.S. Matthias I hope you don't mind I do the review, right? > > Not at all. Cool. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |