Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
How do I create a dynamic wrapper for another language?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="has, post: 1760804"] It's pretty easy using Python's introspection features to supply the syntactic sugar. Simple example: class _Callable: def __init__(self, name): self._name = name def __call__(self, **args): # [Do argument name checking, etc. here] # [Dispatch command here] print 'Sending command %r with arguments: %r' % (self._name, args) # TEST class Bridge: def __getattr__(self, name): # [Do command name checking here] return _Callable(name) bridge = Bridge() bridge.foo(bar=1, baz=True) # -> Sending command 'foo' with arguments {'baz': True, 'bar': 1} Also see my Python-to-Apple Event Manager bridge for ideas and/or code: [URL]http://freespace.virgin.net/hamish.sanderson/appscript.html[/URL] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
How do I create a dynamic wrapper for another language?
Top