Re: [pygccxml-development] [FT] recent changes - generated code
Brought to you by:
mbaas,
roman_yakovenko
|
From: Matthias B. <ba...@ir...> - 2006-09-21 10:11:07
|
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)
> 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?
> 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?
> P.S. Matthias I hope you don't mind I do the review, right?
Not at all.
- Matthias -
|