[Pyobjc-dev] NGPython
Brought to you by:
ronaldoussoren
From: Helge H. <hel...@op...> - 2004-02-29 20:17:26
|
Hi, just tried out the 1.1b1 release, very nice :-) Actually I have written an Objective-C bridge for Python on GNUstep/libFoundation some five years ago, this was called NGPython. While it doesn't seem to compile anymore out of the box even on GNUstep, I thought someone might be interested in ripping of some code nevertheless. The most interesting part is probably the "pybridget2.py" tool contained in NGPython. This is actually a parser for headers and "jobs" files - similiar to those used for the NeXT Java bridge, and for generating class wrapping information. It was pretty flexible on mapping Python function names to selectors: ---snip--- class NSSet = FoundationCollections.NSSet constructor -initWithArray: constructor -initWithSet: @{ keyConstructors = { "array": "initWithArray", "set": "initWithSet" } lenConstructors = { 0: "init", 1: "initWithArray" } @} -allObjects ---snap--- For construction of Python objects you could then use code like this: ---snip--- set = NSSet(array=myarray) set = NSSet(set=otherSet) ---snap--- With the mapping mechanism taking keywords and positional parameters into account. I think that this was much more beautiful than the current automatic ":" => "_" scheme used in PyObjC ;-) So, if someone is interested, drop me a line and I send you the code ;-) Unfortunately I won't find the time to look at adding the mapping stuff to PyObjC, but maybe someone else has ... best regards, Helge -- http://docs.opengroupware.org/Members/helge OpenGroupware.org |