[C++-sig] Registration order in pyplusplus

Niall Douglas s_sourceforge at nedprod.com
Thu Feb 9 11:21:24 CET 2006


On 9 Feb 2006 at 7:59, Roman Yakovenko wrote:

> I am sure this solution works. I have only one problem with this
> solution: it works
> only in case you want to export declarations, from single header file.

Indeed. Pyste only worked correctly when you did this because of this 
exact reason.

> Solution for the problem:
> function_t and constructor_t code creators has property "use_keywords"
> This property is responcible for generation of keyword arguments. If you set
> it to False, then keyword arguments will not be generated.

Seems a shame. Pyste never told python about default arguments, so if 
you asked for help on that API from within python you couldn't see 
what the defaults were. Furthermore, later on, I'm sure you will want 
to integrate docstrings pulled from doxygen output and if the 
parameter names are not known you won't be able to print per-
parameter (\param) docs.

> Here is relevant code:
> 
> relevant_classes = (code_creators.function_t, code_creators.constructor_t )
> calldefs = filter( lambda creator: isinstance( creator, relevant_classes )
>                        , code_creators.make_flatten( extmodule.creators ) )
>   for calldef in calldefs:
>      calldef.use_keywords = False
> 
> Your version of pyplusplus already has this functionality, but it has few bug.
> Please, use latest CVS version.

No chance of sorting based on arg() usage being added?

Your other email where arg() doesn't need predefinition is equally a 
solution. BPL could lazily add in the type info later, but it would 
involve maintaining a list of where that type has been used in an 
arg() and retrospectively linking it in when the definition is made. 
I have a feeling that Dave won't want that extra complexity when you 
can just reorder the registrations.

Cheers,
Niall






More information about the Cplusplus-sig mailing list