On 5/21/07, <b class="gmail_sendername">Albert Strasheim</b> <<a href="mailto:fullung@gmail.com">fullung@gmail.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all<br>...<br>without a copy of cmatrix's contents having to be made. Now I'd just<br>like to get rid of the asarray bit so that it looks like my wrapped<br>functions return NumPy arrays. In Python I can "decorate" this function
<br>like so:<br><br>def return_asarray(func):<br> from numpy import asarray<br> def call(*args, **kwargs):<br> return asarray(func(*args, **kwargs))<br> return call<br>WrappedClass.somefunc = return_asarray(
WrappedClass.somefunc)<br><br>but I would like to move this "decoration" into the C++ code, so that<br>my module doesn't need to have the extra Python bits.<br><br>Any thoughts on how this could be done? I looked at the documentation
<br>for class_, but nothing jumped out at me.<br></blockquote></div><br>Even call policies? If I understand right, you can create new call policy, implement postcall only member function and that's all. <br><br>Am I missing something?
<br clear="all"><br>-- <br>Roman Yakovenko<br>C++ Python language binding<br><a href="http://www.language-binding.net/">http://www.language-binding.net/</a>