[PyQt] SIP: overloaded functions with the same Python signature

Andreas Pakulat apaku at gmx.de
Thu Jul 8 15:33:48 BST 2010


On 08.07.10 14:01:21, GOO Creations wrote:
> With getFileHash(QString()) the first overload is being called.

No its not, the code doesn't even compile if you call getFileHash with
anything but 3 arguments. See this example (its the same thing, except no
Qt depdendencies):

#include <stdio.h>
class Bar {
    public:
void foo( char* data, bool f = true, int x = 10 ) {
    fprintf(stderr, "1\n");
}
void foo( char* data, bool f = true ) {
    fprintf(stderr, "1\n");
}
};

int main()
{
    Bar b;
    b.foo( "test" );
}

This doesn't compile with either gcc or msvc and I doubt you'll find any
C++ compiler compiling this code.

Andreas

-- 
Tonight's the night: Sleep in a eucalyptus tree.


More information about the PyQt mailing list