using special characters in functions: Python
I am writing an xmlrpc client which uses a server 开发者_如何学Gowritten in ruby. One of the functions is framework.busy?(). Let me show the ruby version:
server.call( "framework.busy?" )
So lets assume I create an instance of the ServerProxy class say server. So while using python to call the function busy? I need to use:
server.framework.busy?()
This leads to an error:
SyntaxError: invalid syntax
How can I call this function? Or am I reading the ruby code wrong and implementing it wrongly.
I've never had to call XML methods with a question mark in (and I strongly suspect it might actually be outside XML-RPC specs), but try this:
server.framework.getattr('busy?')()
I have no idea of that works, and you would need to post a code example and have a working server I could test against. :)
In any case it's probably not a good idea to have a question mark in the method name, so if you can modify the Ruby server to something more sane, that would be helpful.
精彩评论