Sorry, Peter! There are actually two ways in which what you're
trying to do won't work :/
First, Python does not support the kind of method overloading you
are thinking about. A method on an object instance is actually itself
a very simply object which always calls the same function. Don't be
disheartened. In practice, Python developers have found they don't
need to use overloaded functions as the parameter system in Python has
it's own flexible advantages. For example, in Java you might do:
int myFunction(String value1) {
...
}
int myFunction(String value1, int value2) {
...
}
In Python, you can use parameter defaults to achieve that kind of
functionality pretty easily:
def my_function(value1, value=20):
...
You still need to handle multiple type parameters inside the
function. There is not that kind of type safety.
The second issues is with Protobuffers, which is the underlying
protocol the ProtoRPC implements. It only supports single message
methods. There are some techniques you can use to make them more
overridable. One very simple way, that is similar to Python, is that
it supports default message values (although the current
implementation does not handle those so gracefully). Another way is
like so:
class MyRequest(Message):
param1 = messages.MessageField(Param1Type, 1)
param2 = messages.MessageField(Param2Type, 2)
The caller will set one parameter OR the other but not both.
I'm not aware of any RPC systems other than Java RMI that supports
method overloading.
--
- Rafe Kaplan