On Sun, Aug 16, 2009 at 10:54 PM, rjf<fate...@gmail.com> wrote: >> > I agree with you entirely, which is why I asked about the 5000 lines >> > with mpz. >> > One possible answer is, "#...@#$%$, Python doesn't have macros."
That is not why the Sage library uses the GMP C library interface in some places. The Sage library uses the GMP C library interface, because much of Sage (several hundred thousand lines of code) is written in Cython, and Cython is really a "smooth blend of C and Python". In short, much of the Sage library *is* literally C code (but without semicolons), and it is completely natural that C code that uses the GMP library would... use the GMP library. >> But I bet cython does. It also depends what you want to call a macro. > > Uh, do I read into this an admission that PYTHON DOES NOT HAVE > MACROS? > I truly did not know (until today) that Python had no macro processing > capability. > I don't know what excuses you might have for saying "it depends". But > it's > awfully handy. Python code does not have "macros" in the sense of say #define in CPP (the C preparser). I personally think this is one of the (many) brilliant design decisions that Guido van Rosum made that explain why I find Python code is frequently easier to read than much C/C++ and Lisp code. I am really glad Python is so readable, since that is absolutely critical in creating a large community of people working voluntarily on a mathematics software project. The Sage project as a volunteer project at its current scale would be impossible if it were done in Lisp or C/C++, just because of difficulty of getting such a wide range of people going with the codebase. The proof is in the pudding. In fact, this has turned out to be much more important than I had thought it would be. Bill Hart said: >> By and large Python is much easier to use than most other languages. > > So you are familiar with most other languages? There are research papers and studies about productivity of programmers using various languages. Here's one: http://sequoia.cs.byu.edu/files/pubs/Delorey2007.pdf It looks at the top 10 most popular languages used by 9999 sourceforge projects, which unfortunately doesn't include Lisp. The productivity rankings they arrive at are: Javascript > Perl > Tcl > Python > PHP > Java > C > C++ > C# > Pascal It takes a large amount of work to do such studies, but fortunately they have been done, and continue to be done. I *greatly* appreciate the work of researchers who apply solid statistical methods to these sorts of questions, because the results provide valuable insight into how as a community we can all be more productive. (+1 to slashdot for popularizing some of this research.) >> So even if it were true that python didn't have a convenient level >> upon which to implement such a thing, the enormous number of other >> conveniences over a language like Lisp far outweigh this disadvantage. > > Actually, I assumed the advantage of Python was that it had many > libraries to access > operating system facilities in a manner that was relatively > independent of the operating > system. > And that, although it had a foolish policy regarding indentation, it > was nevertheless > not too much unlike Lisp, and only a moderate factor slower. Yep, those are probably some of the reasons for Python being popular. >> It has not been >> done because of a (valid) design decision to keep the syntax as close >> to python as possible (the Sage preprocessor does almost nothing). > > If it were a good decision, I think one would not have to write mpz_s > so much. What is wrong with writing code that uses the GMP library directly? The GMP library API is clean, mature, explicit, well thought out, offers hundreds of useful functions, is stable, and code written than uses it is often straightforward to read and understand, and is very fast. Many programmers like writing tight "inner loop" code that has to be fast against the GMP API. I *like* GMP. -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---