[C++-sig] Pyste bug - static member functions...

Nicodemus nicodemus at globalite.com.br
Tue Jun 17 08:56:29 CEST 2003

Roman Sulzhyk wrote:

>Another thing I've noticed, that for static member functions the code
>generated defines them in class scope instead of global scope, causing
>Basically, you need to change the 'PointerDeclaration' of Method class
>to look more like this:
>        # If a method is static, don't need the class specifier
>        if self.static:
>            scope = '*'
>        else:
>            scope = '%s::*' % self.class_
>        if self.const:
>            const = 'const'
>        return '(%s (%s)(%s) %s)&%s' %\
>            (result, scope, params, const, self.FullName())
>That fixes the problem.

You do not seem to be using the latest CVS, Pyste uses staticmethod to 
declare static member functions:

struct C
    static int foo() { return 0; }

// Module 
    class_< C >("C", init<  >())
        .def(init< const C & >())
        .def("foo", &C::foo)


If you are not using the latest CVS, then I might be misunderstanding 
the problem, but I *stronly* suggest that you use the latest CVS from 
both Boost.Python and Pyste... Pyste specifically has had lots of bug 
fixes and some new features since the 1.30.0 release of Boost. ;)

>I also like Dave's suggestion to use the term 'final' to denote virtual
>functions that  are not expected to be overloadable from Python.

I considered it too, but I thought that "no_override" was more clear. 
What you guys think?


More information about the Cplusplus-sig mailing list