Overloading methods in C API

Gerhard Häring gerhard.haering at gmx.de
Sat Jan 18 13:50:52 CET 2003


Afanasiy wrote:
> On 18 Jan 2003 12:55:08 +0100, martin at v.loewis.de (Martin v. Löwis) wrote:
> 
>>Afanasiy <abelikov72 at hotmail.com> writes:
>>
>>> How is it expected I create overloaded methods/functions in the C API?
>>
>>This is not possible. Overloading of methods is not supported in Python.
> 
> As a matter of principle?

Not as a matter of principle. The language just doesn't support it
having multiple methods with the same name in the same class.

Of course you can subclass a class and override a method.

You can, however, have functions with a variable number of arguments.

At the C API, the function you'll need to implement this is
PyArg_ParseTupleAndKeywords.

Gerhard
-- 
Favourite database:             http://www.postgresql.org/
Favourite programming language: http://www.python.org/
Combine the two:                http://pypgsql.sf.net/
Embedded database for Python:   http://pysqlite.sf.net/




More information about the Python-list mailing list