www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Python integration?

reply David Rushby <David_member pathlink.com> writes:
Does anyone know what has become of the D-ification of the Python C API by
Justin Calvarese?  All of the links I can find to it are dead:
http://www.scratch-ware.net/D
http://www.scratch-ware.net/dfiles

Thanks.
Oct 16 2005
parent reply J C Calvarese <technocrat7 gmail.com> writes:
In article <diu147$23nr$1 digitaldaemon.com>, David Rushby says...
Does anyone know what has become of the D-ification of the Python C API by
Justin Calvarese?  All of the links I can find to it are dead:
http://www.scratch-ware.net/D
http://www.scratch-ware.net/dfiles

Thanks.

Actually, it's Deja Augustine's project. I haven't been involved with any of his projects. I've just made an effort to figure out where they went when the links have gone dead. It looks like he might not even have a website anymore except for http://mywebspace.wisc.edu/daaugustine/, but I can't find the Python project there. I suspect I have the files from his Python project saved on a CD somewhere. Do you want me to try and find them sometime? jcc7
Oct 16 2005
parent reply David Rushby <David_member pathlink.com> writes:
In article <diu68p$27is$1 digitaldaemon.com>, J C Calvarese says...
 I suspect I have the files from his Python project saved on a CD 
 somewhere. Do you want me to try and find them sometime?

I'd appreciate that. I just e-mailed the only address I could find for Deja, and got a delivery failure notice. --- FYI, I'm searching for a language that I can use to write high-complexity and reasonably high-performance extensions for Python. C works fine for simple extensions or for implementing new Python types that perform a few accelerated operations under the hood, but I find C's limited facilities for abstraction a problem when the complexity rises beyond a certain threshold. C++, which I've used for one such high-complexity extension, is more trouble than it's worth. When I give up the seamless integration with Python that C provides, I'd like more of a payoff than the boatload of half-measures and gratuitous complexity that is C++. Right now, the major contenders are D, Dylan, and OCaml. For the task of writing Python extensions, D appears to be the most appropriate contender. D has the best performance and C integration of the three, and of course the programming paradigm it encourages is a less radical departure from the imperative mainstream of object-oriented languages. I'm worried about the native code generator not being open source, though. I can understand why Walter's chosen that path, but I wonder about the impact on the timeliness of bug fixes, as well as on portability. From an aesthetic perspective, I like Dylan best, though its execution efficiency isn't quite up to par with D or OCaml. Dylan feels halfway between Python and Common Lisp, with optional static typing available when good execution efficiency is necessary. Once the superficialities are set aside, Dylan reminds me of what Python might have been if it had made some concessions to high execution efficiency instead of unconditionally prioritizing programmer productivity. Generic functions and multiple dispatch instead of method containment and single dispatch look intriguingly flexible, and limited types could be a real boon. But the Dylan community is tiny and hasn't been very responsive to my inquiries. I'm impressed by OCaml's fusion of the functional and object-oriented paradigms without sacrificing execution efficiency. However, it's pretty obvious that OCaml is meant to be programmed in a functional style, with the imperative style resorted to only when maximal efficiency is necessary. My entire purpose in writing extensions to Python is usually efficiency, so I expect that OCaml wouldn't be a very comfortable fit for the task. If the folks on this list have any feedback, I'd welcome it.
Oct 16 2005
next sibling parent "Walter Bright" <newshound digitalmars.com> writes:
"David Rushby" <David_member pathlink.com> wrote in message
news:diub0e$2bf7$1 digitaldaemon.com...
 For the task of writing Python extensions, D appears to be the most

 contender.  D has the best performance and C integration of the three, and

 course the programming paradigm it encourages is a less radical departure

 the imperative mainstream of object-oriented languages.  I'm worried about

 native code generator not being open source, though.  I can understand why
 Walter's chosen that path, but I wonder about the impact on the timeliness

 bug fixes, as well as on portability.

There's a 100% open source D compiler, gdc, prepared by David Friedman. Ports of it exist for a variety of popular platforms. As for DMD's code generator, it is the same as used for DMC and DMC++. It's been developed and debugged for over 20 years now, and it works. Occaisionally a bug does crop up in it, but 99% of the time it's in new code added to support D things.
Oct 16 2005
prev sibling next sibling parent reply J C Calvarese <technocrat7 gmail.com> writes:
In article <diub0e$2bf7$1 digitaldaemon.com>, David Rushby says...
In article <diu68p$27is$1 digitaldaemon.com>, J C Calvarese says...
 I suspect I have the files from his Python project saved on a CD 
 somewhere. Do you want me to try and find them sometime?

I'd appreciate that.

Okay, it wasn't a problem finding it. I suspect it's the most recent file, but I don't think he's worked on it in a while. I don't know if it's what you're looking for. I think it's just a header that allows using Python from D. Since it's old it might need updating to work with recent versions of D (I didn't bother to check it at all). Since I don't know you e-mail address, I just uploaded it: http://jcc_7.tripod.com/d/pythond/index.html jcc7
Oct 16 2005
parent David Rushby <David_member pathlink.com> writes:
In article <diuvg5$rvg$1 digitaldaemon.com>, J C Calvarese says...
Okay, it wasn't a problem finding it. I suspect it's the most recent file, but I
don't think he's worked on it in a while.

Yes, it's just a D header file for the Python/C API, which is what I expected. I haven't decided yet whether I'll pursue Dylan or D, so I'm not sure I'll follow up on this, but thank you very much for finding it.
Oct 17 2005
prev sibling parent Dave <Dave_member pathlink.com> writes:
In article <diub0e$2bf7$1 digitaldaemon.com>, David Rushby says...
In article <diu68p$27is$1 digitaldaemon.com>, J C Calvarese says...
 I suspect I have the files from his Python project saved on a CD 
 somewhere. Do you want me to try and find them sometime?

I'd appreciate that. I just e-mailed the only address I could find for Deja, and got a delivery failure notice. --- For the task of writing Python extensions, D appears to be the most appropriate contender. D has the best performance and C integration of the three, and of course the programming paradigm it encourages is a less radical departure from

I'm thinking DMD will get even faster sooner rather than later - there are some optimizations that (even I can tell) could be done but probably haven't been because the compiler and lang. spec. ideally would be static (which I don't think is all that far off either) to avoid re-work.
the imperative mainstream of object-oriented languages.  I'm worried about the
native code generator not being open source, though.  I can understand why
Walter's chosen that path, but I wonder about the impact on the timeliness of
bug fixes, as well as on portability.

Realistically, I've personally never heard of someone actually hacking GCC to fix a bug that they wouldn't be better off reporting and waiting for an experienced maintainer to fix while they work around the problem. So I'm wondering if that is really a valid concern? DMD releases are frequent and if you provide a good, minimal example of a show-stopping bug, then chances are it will be fixed very quickly - quicker than GCC from what I've seen. Plus the DMD code generator is very mature. The backend portability may be an issue right now, though. For some of that, there is GDC available here: http://home.earthlink.net/~dvdfrdmn/d/ HTH.
Oct 17 2005