[C++-sig] pyste question

Baptiste Lepilleur gaiacrtn at free.fr
Mon Aug 23 08:54:08 CEST 2004


If I remember correctly, you need to add an 'Include' statement with a file
that contains the function you are refering to in add_method().

If it fails, you can still fallback in 'class_code' to inject your method
definition (you can find some example of this at:
http://cvs.sourceforge.net/viewcvs.py/ogre/ogreaddons/pyogre/src/pyogre/ ).

Baptiste.

----- Original Message ----- 
From: "Andrew Sutton" <asutton at cs.kent.edu>
To: <c++-sig at python.org>
Sent: Friday, August 20, 2004 4:50 AM
Subject: [C++-sig] pyste question


> hi... pyste noob here.
>
> i'm building some python interfaces for a library i've written and i'm
trying
> to make the exposed python classes as "python-friendly" as possible (like
> nice iteration support). to do this, i'm trying to inject methods into my
> classes using add_method(). unfortunately, pyste is not finding the
methods
> i'm requesting to be added.  it seems to be related to the fact that the
> methods i'm having pyste add to the class aren't located in the same
header
> file as the class. for example:
>
> [list.hpp]
> class list {
>  ...;
> }
>
> [list_ext.hpp]
> iterator list_iterator();
>
> [list.pyste]
> List = Class("list", "list.hpp")
> ListIterator = Function("list_iterator, "list_iterator.hpp")
> add_method(List, "list_iterator", "__iter__")
>
> or something very similar to that. it seems that the behavior of
add_method
> only looks for methods defined in the file with the class - because this
> doesn't work with includes or added code either - quite frustrating.
>
> am i going about this completely wrong? any help would be appreciated.
thanks
> in advance.
>
> andrew sutton
> asutton at cs.kent.edu
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>




More information about the Cplusplus-sig mailing list