Re: Fortran vs Python - Newbie Question
On 26 Mar 2007 06:20:32 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: OK... I've been told that Both Fortran and Python are easy to read, and are quite useful in creating scientific apps for the number crunching, but then Python is a tad slower than Fortran because of its a high level language nature, so what are the advantages of using Python for creating number crunching apps over Fortran?? Thanks Chris Dear Chris, Why are you focusing on Python vs. Fortran? There might be other choices out there you might want to consider, specifically C, O'Caml, and Ada, since you mention number crunching. When choosing, you should consider what other requirements you'll have; some people have hinted at a few, such as portability (I am not saying fortrain ain't portable) and rapid application development. Will you be doing lots of string manipulation? Processing text-files? Gluing applications? What do people around you use? What type of number crunching will you be doing? Are the libraries available in any of the languages that you are considering that do some/most of what you want to do? Are you concernded about concurrent/distributed programming? Is this your first programming language? Etc, etc, etc. In the end, maybe neither Python nor Fortran might be the best choices for you. HTH, R. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: book for a starter
On 2/27/07, Wensui Liu [EMAIL PROTECTED] wrote: Thank you all for your wonderful suggestion and advice. Have a great evening! wensui On 27 Feb 2007 12:08:46 -0800, RickMuller [EMAIL PROTECTED] wrote: On Feb 27, 12:08 pm, Sriram [EMAIL PROTECTED] wrote: Hi, If you have experience programming, just read the online tutorial athttp://docs.python.org/tut/tut.html Seconded. It really is a wonderful introduction to Python. Once you've digested that, the Python Library Reference in the docs is your best friend. The nice thing about getting familiar with the official python documentation is that it's always available to you. -- http://mail.python.org/mailman/listinfo/python-list WenSui, from the R list I think you are not a novice programmer. I'd recommend Python in a Nutshell. Note there is a recent edition that covers Python 2.5. (I actually use almost exclusively Nuthsell --- and the pocket reference which is small and inexpensive and i carry on my backpack all the time). Best, R. -- WenSui Liu A lousy statistician who happens to know a little programming (http://spaces.msn.com/statcompute/blog) -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Python does not play well with others
I find Paul Rubin's arguments compelling and convincing. As just a Python user (i.e., someone who has contributed nothing) let me add a few comments along the same lines. On 03 Feb 2007 18:31:03 -0800, Paul Rubin http://phr.cx@nospam.invalid wrote: [EMAIL PROTECTED] writes: Paul Why would I expect your employer to solve my problems anyway, even Paul if they relate to some module that you actually use? Your reasoning seems to be that Python should contain the functional union of everything at least in Java and PHP if not Perl, Ruby and Tcl as well. I wouldn't go quite that far. I think there are specific application areas, such as web server apps, where the Python advocates here on clpy pitch Python relentlessly against those other languages. Given that context, Python's stdlib should try to match the libraries of those other languages in those areas. There are other areas where Python doesn't get pitched as hard and the other languages have acknowledged advantages. So it's ok if Python's stdlib gets less attention in those areas. In fact, it is quite frustrating to operate under the impression that Python is good for X, Y, Z, and then realize ooops, it is becoming a pain in the ass to do X, whereas language L does X just fine. It seems to me that Python advocates sometimes (often?) get carried away. DB sure, no problem; web-frameworks who needs Rails, we have (lots of) frameworks that do it; functional programming Python can do all the functional programming anyone in his/her mind should ever try to do; etc. Compare this to the, in my opinion, equanimous, fair, advertisement one finds in the Erlang page or the recognition by schemers that scheme is not the only game in town. If you want to turn the Python distribution into a kitchen sink, make the argument on python-dev and be prepared to shoulder your share of the burden should your arguments sway the group as a whole. We've had this conversation before and I continue to think your reasoning above is invalid. I'm not a Python developer, I'm just a user, and my volunteer coding priorities are elsewhere, as I've explained before. Python's developers and advocates have a declared goal of reaching as many users as they can, and as a user I don't mind offering suggestions about how to do that, but my responsibilities don't go any further. R. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Py 2.5 on Language Shootout
On 20 Jan 2007 14:19:12 -0800, Isaac Gouy [EMAIL PROTECTED] wrote: Ramon Diaz-Uriarte wrote: On 20 Jan 2007 11:34:46 -0800, Isaac Gouy [EMAIL PROTECTED] wrote: (...) And that's why the existence of CINT is such a stark reminder of the separation between the language and the implementation. When people think of C what do they think of - gcc? tiny-c? intel c? microsoft c? some mythical C implementation? Really, this ain't my war. Sure, there are two things: the language and the implementation. But, for practical purposes, when most people today say Python they mean CPython, whereas if the say Scheme, they certainly need to say _which_ Scheme (I think only PLT is in the official shootout page; there are others in the beta tests). If people want to mean Jython or Stackless, they just say that. As for C, I think people will need to qualify what exactly they mean. I think all these issues do not really lead to confusion for most of us; certainly not if you go to the shootout page. But as I said, this ain't my war. I was simply pointing out that correcting one poster for talking about languages when referring to python was hair splitting. And I think we are all running in circles, because I guess we all agree. This is turning into what in Spain (a country of catholic tradition) we call a discussion about the sex of the angels (el sexo de los angeles), i.e., whether angels are male or female or something else. Since sexing angels is not my area of expertise, I'll just shut up (I actually don't really know why I even said anything about this issue; please, forgive my chatiness). In England the corresponding expression is Counting Angels on a Pinhead http://dannyayers.com/2001/misc/angels.htm Thanks, that is neat. I find the discussion on the sex of the angels, well, sexier. But we are probably a few hundred years late to start a catholic-protestant religious war here :-). R. Best, R. I think readers understood the previous poster. Best, R. Cheers, Carl Friedrich Bolz -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Py 2.5 on Language Shootout
On 1/20/07, Carl Friedrich Bolz [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Looking over the benchmarks, one gains the impression that Python is a slow language. What does that even mean - a slow language? The alioth benchmarks provide a set of numbers by which languages may be compared. Wrong. The benchmarks provide a set of numbers by which _implementations_ of languages can be compared. After all, it is possible that someone implements a magic-pixie-dust-interpreter that executes Python programs several orders of magnitude fastes than CPython. Or you could say that C is slow because if you use CINT, a C interpreter ( http://root.cern.ch/root/Cint.html ) to execute it, it is slow. Yeah, but this is hair-splitting. Except for Jython, IronPython, and Stackless, I think when we say Python is slow/fast we think CPython (otherwise, we qualify the implementation). For that matter it is often said the GIL ...; oh, but wait, Stackless ... With other languages (e.g., Common Lisp) the separation between the language and the implementation is key because, to begin with, there is something external from, and independent of, any particular implementation. That is not the case with Python. And the example of CINT is hair-splitting to the nth power.To begin with, I do not think CINT implements the full standard C. But even if it were, when people think of C they rarely think of CINT. I think readers understood the previous poster. Best, R. Cheers, Carl Friedrich Bolz -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Py 2.5 on Language Shootout
On 20 Jan 2007 11:34:46 -0800, Isaac Gouy [EMAIL PROTECTED] wrote: Ramon Diaz-Uriarte wrote: On 1/20/07, Carl Friedrich Bolz [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Looking over the benchmarks, one gains the impression that Python is a slow language. What does that even mean - a slow language? The alioth benchmarks provide a set of numbers by which languages may be compared. Wrong. The benchmarks provide a set of numbers by which _implementations_ of languages can be compared. After all, it is possible that someone implements a magic-pixie-dust-interpreter that executes Python programs several orders of magnitude fastes than CPython. Or you could say that C is slow because if you use CINT, a C interpreter ( http://root.cern.ch/root/Cint.html ) to execute it, it is slow. Yeah, but this is hair-splitting. Except for Jython, IronPython, and Stackless, I think when we say Python is slow/fast we think CPython (otherwise, we qualify the implementation). For that matter it is often said the GIL ...; oh, but wait, Stackless ... When we say Python is slow/fast what does slow/fast mean? Oh, well, I have no idea. I guess you'd have to define what speed and, if that is a single number, then we can just rank languages. We'd probably never agree on how to obtain a single number. But I think most of us, when looking at the shootout, can see that there are some languages that, for most of the programs, are consistently faster than the rest, and others that are consistently slower. But really, I think the shootout page has large, detailed and b/b statements about the perils and pitfalls of measuring these things. (And I do not go to the shootout to hear the oracle tell me which language I should use in my next project). With other languages (e.g., Common Lisp) the separation between the language and the implementation is key because, to begin with, there is something external from, and independent of, any particular implementation. That is not the case with Python. And the example of CINT is hair-splitting to the nth power.To begin with, I do not think CINT implements the full standard C. But even if it were, when people think of C they rarely think of CINT. And that's why the existence of CINT is such a stark reminder of the separation between the language and the implementation. When people think of C what do they think of - gcc? tiny-c? intel c? microsoft c? some mythical C implementation? Really, this ain't my war. Sure, there are two things: the language and the implementation. But, for practical purposes, when most people today say Python they mean CPython, whereas if the say Scheme, they certainly need to say _which_ Scheme (I think only PLT is in the official shootout page; there are others in the beta tests). If people want to mean Jython or Stackless, they just say that. As for C, I think people will need to qualify what exactly they mean. I think all these issues do not really lead to confusion for most of us; certainly not if you go to the shootout page. But as I said, this ain't my war. I was simply pointing out that correcting one poster for talking about languages when referring to python was hair splitting. And I think we are all running in circles, because I guess we all agree. This is turning into what in Spain (a country of catholic tradition) we call a discussion about the sex of the angels (el sexo de los angeles), i.e., whether angels are male or female or something else. Since sexing angels is not my area of expertise, I'll just shut up (I actually don't really know why I even said anything about this issue; please, forgive my chatiness). Best, R. I think readers understood the previous poster. Best, R. Cheers, Carl Friedrich Bolz -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Wow, Python much faster than MatLab
On 12/31/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: R is the free version of the S language. S-PLUS is a commercial version. Both are targeted at statisticians per se. Their strengths are in exploratory data analysis (in my opinion). SAS has many statistical featues, and is phenomenally well-documented and supported. One of its great strengths is the robustness of its data model -- very well suited to large sizes, repetitive inputs, industrial-strength data processing with a statistics slant. Well over 200 SAS books,for example. I think of SAS and R as being like airliners and helicopters -- airlines get the job done, and well, as long as it's well-defined and nearly the same job all the time. Helicopters can go anywhere, do anything, but a moment's inattention leads to a crash. -- inattention leading to a crash? I don't get it. I used SAS for about 3 or 4 years, and have used S-Plus and then R for 10 years (R for 8 years now). I've never noticed inattention leading to a crash. I've noticed I cannot get away in R without a careful definition of what I want (which is good), and the immediate interactivity of R is very helpful with mistakes. And of course, programming in R is, well, programming in a reasonable language. Programming in SAS is ... well, programming in SAS (which is about as fun as programming in SPSS). (Another email somehow suggested that the stability/instability analogy of airplanes vs. helicopters does apply to SAS vs. R. Again, I don't really get it. Sure, SAS is very stable. But so is R ---one common complaint is getting seg faults because package whatever has memory leaks, but that is not R's fault, but rather the package's fault). But then, this might start looking a lot like a flame war, which is actually rather off-topic for this list. Anyway, for a Python programmer, picking up R should be fairly easy. And rpy is really a great way of getting R and Python to talk to each other. We do this sort of thing quite a bit on our applications. And yes, R is definitely available for both Linux and Windows (and Mac), has excellent support from several editors in those platforms (e.g., emacs + ess, tinn-R, etc), and seems to be becoming a de facto standard at least in statistical research and is extremely popular in bioinformatics and among statisticians who do bioinformatics (look at bioconductor.org). Ramon -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: About alternatives to Matlab
On 12/12/06, Jon Harrop [EMAIL PROTECTED] wrote: Paul Rubin wrote: Well, work is already under way (already mentioned) to implement Python in Python, including a reasonable compiler (Psyco). The big deficiency of MLton from a concurrency perspective is inability to use multiprocessors. Of course CPython has the same deficiency. Same with OCaml. Is the ML community trying to do anything about this? Yes. Several MLs support concurrency. Perhaps F# is the most notable in this case because it would provide an easier path to JIT (to .NET IL). Concurrent GC seems to be a lot slower though (e.g. Java or .NET vs OCaml or MLton). Would this be of any interest? (specially since the Lisp vs. Python thread seems to be dying out :-). Its Scheme (Gambit, so one of the speedy Schemes) with Erlang-like concurrency http://toute.ca/ http://lambda-the-ultimate.org/node/841 Best, R. -- Dr Jon D Harrop, Flying Frog Consultancy Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/index.html?usenet -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: merits of Lisp vs Python
On 08 Dec 2006 19:56:42 -0800, Paul Rubin http://phr.cx@nospam.invalid wrote: (...) Lisp just seems hopelessly old-fashioned to me these days. A modernized version would be cool, but I think the more serious Lisp-like language designers have moved on to newer ideas. Paul, I find most of your comments well thought. But I don't follow these. Could you elaborate? a) old-fashioned? Is that supposed to be an argument? I guess addition and multiplication are old-fashioned, and so is calculus;so? I think old-fashioned should only carry a negative connotation in the fashion world, not in programming. b) the more serious Lisp-like language designers have moved on to newer ideas. Can you elaborate? I am not an expert but by looking at, say, lambda the ultimate, I'd say this statement is just not true. And which are these newer ideas; what programming languages are incorporating them? (Scala, Mozart/Oz, Alice-ML, ...). R. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Book recommendations
On 6 Dec 2006 05:55:44 -0800, Robert Hicks [EMAIL PROTECTED] wrote: On Dec 6, 7:09 am, west [EMAIL PROTECTED] wrote: Can someone recommend a Python book for a newbie and perhaps you have a used one for sale? Thank you. I think a lot depends on your experience with other programming languages. If you are new to Python, but not to programming, I'd definitely go for Python in a nutshell. To the point, loaded with information, and a great resource. And I'd get Python pocket reference, which might be, for long periods, the only thing you need to open. If you do not have a lot of programming experience, you might want to look at How to think like a computer scientist, A byte of Python (both freely available over the net), and then go for Core Python Programming. Beginning Python: From Novice to Professional by Magnus Lie Hetland Core Python Programming (2nd Edition) by Wesley Chun There are plenty of Free online ones as well. HTH Robert -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: About the 79 character line recommendation
On 5 Dec 2006 13:28:22 -0800, Steve Bergman [EMAIL PROTECTED] wrote: (...) I'm finding 100 to be a nice balance. It forces me not to be lazy and allow really long lines, but allows me to format so as to make the meaning most clear. But if you use some advanced editors (such as Emacs) that easily allow you to see/edit the same file in two buffers side by side, then going beyond 80 chars is often a bad idea, specially if you use a laptop. (And, of course, there is the eternal issue of doing a simple a2ps to print some code; longer than 80 and you often have hard to read pages). Best, R. -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: About alternatives to Matlab
R (http://cran.r-project.org) might be an alternative, specially if you do a lot of statistics and graphics. (R is probably the most widely used language/system in statistical research). R. On 16 Nov 2006 13:09:03 -0800, sturlamolden [EMAIL PROTECTED] wrote: Boris wrote: Hi, is there any alternative software for Matlab? Although Matlab is powerful popular among mathematical engineering guys, it still costs too much not publicly open. So I wonder if there's similar software/lang that is open with comparable functionality, at least for numerical aspect. Thanks! I have used Matlab for years, and has recently changed to Python. In addition one needs NumPy and Matplotlib, and perhaps SciPy. Other useful packages are PyGTK for GUI, PyGame for multimedia, PyOpenGL for 3D graphics, Mpi4Py for parallel computation, etc. You will find python packages for nearly any conceivable task. Unlike Matlab, Python is a general purpose programming language, and a distant cousin of Lisp. The Python language is fare more expressive and productive than Matlab, yet even more easy to use. The NumPy package is the core requirement for numerical work in Python. It is quite different form Matlab, but I think it is more powerful. Particularly, arrays are passed by reference (not by value), and indexing creates view matrices. To compare Matlab with NumPy we can e.g. use the D4 discrete wavelet transform. I have here coded it in Matlab and Python/NumPy using Tim Swelden's lifting scheme. First the Matlab version (D4_Transform.m): function x = D4_Transform(x) % D4 Wavelet transform in Matlab % (C) Sturla Molden C1 = 1.7320508075688772; C2 = 0.4330127018922193; C3 = -0.066987298107780702; C4 = 0.51763809020504137; C5 = 1.9318516525781364; s1 = zeros(ceil(size(x)/2)); d1 = zeros(ceil(size(x)/2)); d2 = zeros(ceil(size(x)/2)); odd = x(2:2:end); even = x(1:2:end-1); d1(:) = odd - C2*even; s1(1) = even(1) + C2*d1(1) + C3*d1(end); s1(2:end) = even(2:end) + C2*d1(2:end) + C3*d1(1:end-1); d2(1) = d1(1) + s1(end); d2(2:end) = d1(2:end) + s1(1:end-1); x(1:2:end-1) = C4*s1; x(2:2:end) = C5*d2; if (length(x) 2) x(1:2:end-1) = D4_Transform(x(1:2:end-1)); end Then the Python version (D4.py): import numpy import time def D4_Transform(x, s1=None, d1=None, d2=None): D4 Wavelet transform in NumPy (C) Sturla Molden C1 = 1.7320508075688772 C2 = 0.4330127018922193 C3 = -0.066987298107780702 C4 = 0.51763809020504137 C5 = 1.9318516525781364 if d1 == None: d1 = numpy.zeros(x.size/2) s1 = numpy.zeros(x.size/2) d2 = numpy.zeros(x.size/2) odd = x[1::2] even = x[:-1:2] d1[:] = odd[:] - C1*even[:] s1[0] = even[0] + C2*d1[0] + C3*d1[-1] s1[1:] = even[1:] + C2*d1[1:] + C3*d1[:-1] d2[0] = d1[0] + s1[-1] d2[1:] = d1[1:] + s1[:-1] even[:] = C4 * s1[:] odd[:] = C5 * d2[:] if x.size 2: D4_Transform(even,s1[0:even.size/2],d1[0:even.size/2],d2[0:even.size/2]) if __name__ == __main__: x = numpy.random.rand(2**23) t0 = time.clock() D4_Transform(x) t = time.clock() print Elapsed time is %.6f seconds % (t-t0) Now let's do benchmark on my laptop (1.73 GHz Pentium M, 0.99 GB RAM). I have stopped paying for Matlab maintenance (for reasons that will be obvious), so I only have R14 Service Pack 2 for comparison. First we try Matlab (R14 Service Pack 2): x = rand(2^23,1); tic; D4_Transform(x); toc Elapsed time is 27.145438 seconds. Then we Python 2.4.4 with NumPy 1.0: C:\develop\python\D4python D4.py Elapsed time is 3.364887 seconds That is quite astonishing. If anyone wonders why I think Travis Oliphant and the NumPy team should be knighted, then this is the answer. The Mathworks' product only achieved 100% * 3/27 = 11% the speed of Python/NumPy, and is infinitely more expensive. Does anyone wonder why I am not paying for Matlab maintenance anymore? Sorry Mathworks, I have used your product for years, but you cannot compete with NumPy. Cheers, Sturla Molden -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: numpy/scipy: correlation
On 11/12/06, robert [EMAIL PROTECTED] wrote: Robert Kern wrote: robert wrote: (...) One would expect the error range to drop simply with # of points. Yet it depends more complexly on the mean value of the coef and on the distribution at all. More interesting realworld cases: For example I see a lower correlation on lots of points - maybe coef=0.05 . Got it - or not? Thus lower coefs require naturally a coef-err to be useful in practice. (...) I remember once I saw somewhere a formula for an error range of the corrcoef. but cannot find it anymore. (...) Does anybody know how this prob.-value is computed/motivated? Such thing would be very helpful for numpy/scipy too. There is a transformation of the correlation coefficient that is distributed as a t-statistic under the null. This was derived a long way back, and is the usual, standard, way to test for significance of (attach a p-value to) correlation coefficients. I do not recall the formula from top of my head, but I am sure any google search will find it. And of course, any decent intro stats textbook will also provide it. You can look in your nearby library for popular textbooks such as Snedecor Cochran, or Sokal Rohlf, or the wonderful Beyond Anova by Miller, which do have the expression. Since this is such a common procedure all stats programs do provide for tests of significance of correlation coefficients. A whole bunch of them are free, and one is widely used: R (check http://cran.r-project.org). This is an easy way for you to test the output of your stats code in Python. Now, since you can do a significance test, you can invert the procedure and obtain a confidence interval (of whichever width you want) for your correlation coefficients. This CI will (almost always) be assymmetric. (And recall that CI do have a not-obvious interpretation). CI of correlation coefficients are not as common as p-values, but this is doable too. The expression (and improved versions of it, I think Sokal Rohlf show several) is easy to compute. And I bet obtaining the density of a t-distribution with k d.f. is also available already for Python. So this part is definitely doable. Best, R. (...) Now think of adding 'boring data': X=[1.,2,3,4] Y=[1.,2,3,5] sd.correlation((X,Y)) # my old func (1.3, -0.5, 0.982707629824) # m,o,coef numpy.corrcoef((X,Y)) array([[ 1., 0.98270763], [ 0.98270763, 1.]]) XX=[1.,1,1,1,1,2,3,4] YY=[1.,1,1,1,1,2,3,5] sd.correlation((XX,YY)) (1.23684210526, -0.289473684211, 0.988433774639) I'd expect: the little increase of r is ok. But this 'boring data' should not make the error to go down simply ~1/sqrt(N) ... http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient#Trivia says: In MATLAB, corr(X) calculates Pearsons correlation coefficient along with p-value. http://links.jstor.org/sici?sici=0162-1459(192906)24%3A166%3C170%3AFFPEOC%3E2.0.CO%3B2-Y tells: probable error of r = 0.6745*(1-r**2)/sqrt(N) A simple function of r and N - quite what I expected above roughly for the N-only dep.. But thus it is not sensitive to above considerations about 'boring' data. With above example it would spit a decrease of this probable coef-err from 0.0115628571429 to 0.00548453410954 ! And the absolute size of this error measure seems to be too low for just 4 points of data! The other formula which I remember seeing once was much more sophisticated and used things like sum_xxy etc... Robert PS: my old func is simply hands-on based on n,sum_x,sum_y,sum_xy,sum_xx,sum_yy=len(vx),vx.sum(),vy.sum(),(vx*vy).sum(),(vx*vx).sum(),(vy*vy).sum() Guess its already fast for large data? Note: numpy.corrcoef strikes on 2 points: numpy.corrcoef(([1,2],[1,2])) array([[ -1.#IND, -1.#IND], [ -1.#IND, -1.#IND]]) sd.correlation(([1,2],[1,2])) (1, 0, 1.0) numpy.corrcoef(([1,2,3],[1,2,3])) array([[ 1., 1.], [ 1., 1.]]) sd.correlation(([1,2,3],[1,2,3])) (1, 0, 1.0) PPS: A compatible scipy binary (0.5.2?) for numpy 1.0 was announced some weeks back. Think currently many users suffer when trying to get started with incompatible most-recent libs of scipy and numpy. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning Python
On 6 Nov 2006 03:12:34 -0800, kaushal [EMAIL PROTECTED] wrote: On Nov 6, 2:54 pm, Jorge Vargas [EMAIL PROTECTED] wrote: On 6 Nov 2006 01:33:36 -0800, ArdPy [EMAIL PROTECTED] wrote: kaushal wrote: Hi How do i start Learning Python,is there any reference material which I can refer since I dont have any programming experience Thanks and Regards Kaushal Hi kaushal, Look intohttp://diveintopython.org. Dive into python is a really readable ebook...enjoyEven though that's a great book I don't recomend it for non programmers I think thishttp://docs.python.org/tut/is a better way to start also I'll suggest you start learning other programming languaje before python or else this will be the only one you will code :) -- http://mail.python.org/mailman/listinfo/python-list Hi Just wanted to know how is this URL http://www.ibiblio.org/obp/thinkCSpy/ Dear Kaushal, I was going to recommend exactly that one. That is a very nice book, clearly written, not patronizing (some begginers books seem to fall easily into the patronizing mode), and covers a lot of ground. I think dive into python is a great book, but not the best choice if you have no programming experience. I also think that the tutorial by Guido van Rossum is not the best place to start if you have no programming experience. You can also go to: http://www.python.org/doc/ and, in particular, http://wiki.python.org/moin/BeginnersGuide/NonProgrammers. If you are looking for a book I'll pay money for, I'd recommend Core Python Programming, by Chun. It's a thick book, which will keep you busy for a while, and assumes some programming experience. It may be a good place to go _after_ you've gone through How to think like a computer scientist and, probably, have looked at some other material. Good luck, R. Thanks and Regards Kaushal -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: PySchool - Online Python Web Framework Workshop.
Dear Rob, On 4 Nov 2006 06:43:19 -0800, RobJ [EMAIL PROTECTED] wrote: Thanks James and Steve for the feedback I have made the appropriate changes and republished the survey at the following URL: http://killersurvey.com/answer_survey.php?id=490 Thanks for the update. However, a whole bunch of Linux distributions are missing. For instance, I think that both Debian and Gentoo have a large enough user base to deserve an explicit place in that list. And I'd definitely add a way to list your very own distro, if not among the listed, like you do in q. 3. Best, R. Rob J James Stroud wrote: RobJ wrote: Hi! My Name is Rob Johnson and I am a graduate student at The Richard Stockton College of NJ. To make a long story short, I'm working on my Masters project in the MAIT program (Masters of Arts in Instructional Technology). I have written a proposal to put together a free on-line Python web framework workshop. The workshop will be geared to help people new to Python web frameworks. I am asking for the community's assistance to help me get this project off the ground. As part of my project, I am conducting a survey for people who are interested in learning more about python web frameworks. The survey is located at http://killersurvey.com/answer_survey.php?id=479. I have also started a blog about this experience in order to let people know what I'm doing (http://pyschool.blogspot.com/). If you have a few minutes, please take a couple of minutes to take the quick survey. The survey is anonymous and the information will be used for statistics for my project. Also, any constructive feedback or suggestions that you can give me would be gladly appreciated. Thanks Rob J Q9 should be check all that apply or otherwise qualified with primarily. Q10 is missing other types of broadband such as what one might find at school, and also have the option of multiple selections. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: What's the best IDE?
On 10/29/06, Theerasak Photha [EMAIL PROTECTED] wrote: I've used Emacs for a long time, but I think I might be going back to Vim 7.0 now that they improved the scripting functionality with *real* arrays and dicts. In some respects, this is now better than in Emacs, where the hash functionality is...well...cumbersome at best. Main reason would be that Vim is so much easier to customize and find things in than Emacs. I long time ago, I actually submitted a bug Yes, I've read that, and I see that point. And that you can do customization using Python. I've actually been tempted by Vim since I read this http://pinard.progiciels-bpi.ca/opinions/editors.html (and Pinard is someone I do respect, and this is a very well argued document). (...) vimshell is a (nearly) full-blown terminal emulator facility for Vim http://www.wana.at/vimshell/ Thanks for this link! It looks really interesting. I'll try to give it a try ASAP. One question, though: can you send a block of code to a Python shell running in vimshell? (somehow like you can do in Emacs)? R. -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: What's the best IDE?
On 10/26/06, Ben Finney [EMAIL PROTECTED] wrote: Harry George [EMAIL PROTECTED] writes: John Salerno [EMAIL PROTECTED] writes: Yeah, it was all the customizing that I could never figure out. years ago this worked for people I was supporting: set softtabstop=4 shiftwidth=4 expandtab That's all I've ever needed vim to do with my Python code (apart from the syntax highlighting, which works by default when I've tried it). Personally, I'm an emacs guy, so I wouldn't know. Should I start another thread about python-mode and how annoying it is? Ben, as an Emacs guy tempted by Vim I'd definitely like to know what you find annoying about python-mode, and how Vim does not annoy you here. If this answer might risk leading the thread somewhere we don't want, I'd anyway by very interested in a private email. Best, R. -- \ If you get invited to your first orgy, don't just show up | `\ nude. That's a common mistake. You have to let nudity | _o__) 'happen.' -- Jack Handey | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: What's the best IDE?
On 27 Oct 2006 12:14:57 -0700, Adam Jones [EMAIL PROTECTED] wrote: emacs (...) It would be fine for a begginer, right? Probably not. I think you have to spend enough time with environments Actually, I've read similar things before and I don't quite get it. I guess all of us are Emacs begginers the first time we try emacs. Actually, I started using Emacs about 1 month after installing Linux; what hooked me was the possibility of editing code AND submit it to an inferior process, just like that (this I experienced first with R, but of course you can do the same with Python) and using the same environment for all of my editing and programming tasks. R. -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: IDE that uses an external editor?
On 10/14/06, Slawomir Nowaczyk [EMAIL PROTECTED] wrote: On Sat, 14 Oct 2006 13:01:17 -0500 [EMAIL PROTECTED] wrote: (...) # I realize I can do a lot within Emacs/XEmacs, but I suspect with a # tool like Eclipse I could do more. However, I don't want to give up # the text editing power of Emacs to get it. I don't know... I have never, personally, used Eclipse, so I cannot comment on that. It is highly dependent on what you are working on, I presume. I've tried using Eclipse several times, because several good meaning people told me things like you coud do more. But I've always: a) felt overwhelmed and lost (like in this is way too complex); b) felt deprived of valuable screen real-state (it might be personal thing, because on my .emacs I turn off the toolbar and menu bar); c) eventually felt that time reading the Eclipse tutorial and docs would be better spent reading more of the Emacs manual. I guess, though, that this is very personal, and that I might be missing the point of Eclipse (and I don't do any Java programming). -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: switching to numpy and failing, a user story
On 6 Oct 2006 09:26:23 -0700, Istvan Albert [EMAIL PROTECTED] wrote: sturlamolden wrote: Those involved in the development of NumPy must receive some compensation. Financial support to NumPy also ensure that the developmentcan continue. I for one does not want to see NumPy as Then charge for NumPy ... or write a book *besides* the documentation. One in which you make good use of NumPy and demonstrate the actual problem solving process. Charging for docs is just shooting yourself in the foot. I beg to disagree with you (even if I'd rather have the docs for free): 1. You have NumPy available, so you can use it. Paying for software is, for many reasons, and for many of us, an absolute show stopper. 2. For many people the for free docs and help are enough. 3. As already said, this mechanism allows some people to make a contribution that would otherwise be impossible. For instance, if you use NumPy in your job, and your employer (be that a private business or the public sector if you are paid with tax money) benefits from it, how can you return that back? Ask that the book be bought. Moreover, even if, say, I might be willing to pay for the book, maybe my grad students can't; I might be able to use grant money, to purchase a copy for a grad student. (It is actually interesting that in the R help mailing list there are from time to time suggestions that CDs with R ---even if R is GPL'd software that you can download from the web--- be sellable by the R foundation, as a possible way to allow employers to make a contribution to the R project.) Plus that so called documention seems very unwieldy and unattractive, attractiveness is on the eye of the looker, I'd say. A lot of it looks like classical good-looking LaTeX to me. long winded text, you can't search it, google won't index it - people won't find what they are looking for. Many textbooks and reference books are not indexed by google. Yet we pay for them and we use them. These are incoveniences, not fatal blows. Best, R. I. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Computational Statistics Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
On 10/4/06, Richard Jones [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: And i dunno what the case against Trac is (it looks a fine tool for my small projects) but probably it's not good enough for python.org Trac is really good in my experience. Trac was considered. A nice extra is that it is written in python. So are Roundup and Launchpad, two of the other three trackers considered. So, just out of curiosity, what were the pros/cons of Launchpad, specially compared to Roundup? R. Richard -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Questions on Using Python to Teach Data Structures and Algorithms
Going back to the original question, a related question: does anybody know why there are so few books on data structures and algorithms that use Python? I remember that, at least ~ 12 years ago there were many (and very good) books that used Pascal for this topic. So when I did my own search for one in Python (just for my own consumption and enlightnment) and could only find the same one as the original poster of this thread [1], I was very surprised. No publishers have felt the need to fill this gap? Best, R. [1] http://thread.gmane.org/gmane.comp.python.general/486698/focus=486698 Data Structures and Algorithms with Object Oriented Design Patterns (http://www.brpreiss.com/books/opus7/html/book.html) and was surprised. -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Questions on Using Python to Teach Data Structures and Algorithms
On 9/28/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Ramon Diaz-Uriarte wrote: Going back to the original question, a related question: does anybody know why there are so few books on data structures and algorithms that use Python? Probably because Python has better than textbook implementations of core structures, and better than textbook implementations of many core algorithms, so lots of things can be done more efficiently by combining existing structures and algorithms than by using textbook algorithms. OK, point taken. But having that shown explicitly in a (variety of) traditional-looking DSA textbooks would be great. (And for some of us, it might provide a conforting: oh man, see how easy it is now with Python). After all, I think DSA classes are standard in CS curricula. And what does the budding Python programmer answer to his Pascal friend when he says look, here is my linked list? Best, R. /F -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Battlefield Weapon Popularity Trend (was: Computer Language Popularity Trend)
On 9/27/06, Mirco Wahab [EMAIL PROTECTED] wrote: Thus spoke Xah Lee (on 2006-09-27 05:03): This page gives a visual report of computer languages's popularity, as indicated by their traffic level in newsgroups. ... http://xahlee.org/lang_traf/index.html When the Samurai of medieval Japan were confronted with new 'battlefield language', e.g. early Shotguns, they resisted because one could push any peasant shouldn't this be they [the Samurai] did not resist? behind a gun -- thus nullifying the result of the Samurai Art of Warfare that required a life full of learning - in the end wiping out a complete culture. Same trend here - the reason is: 'cost' ;-) Regards scnr Mirco f'up: clpm, clp -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Battlefield Weapon Popularity Trend
On 9/27/06, Mirco Wahab [EMAIL PROTECTED] wrote: Thus spoke Ramon Diaz-Uriarte (on 2006-09-27 11:01): When the Samurai of medieval Japan were confronted with new 'battlefield language', e.g. early Shotguns, they resisted because one could push any peasant shouldn't this be they [the Samurai] did not resist? The resisted believing all the buzz, e.g.: armies made of dudes with guns ... OK, I think I see it. (and tried to preserve their Art, which did not work in the end - the Art of Killing was replaced by mass production of deaths on the battlefield ...) Yeap, that I saw. Thansk, R. Regards, M. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: a different question: can you earn a living with *just* python?
On 9/26/06, John Salerno [EMAIL PROTECTED] wrote: It's a nice thought that a person can earn a living programming with Python, which is fun enough to use just for its own sake. But for someone like me (i.e. no programming experience) it's always a little disheartening to see that most (if not all) job descriptions that ask for Python still require some C/C++ or other language knowledge. I suppose this isn't an issue if you studied CS in college, because you would have been exposed to many languages. But what if you are an expert Python program and have zero clue about other languages? Can you still earn a living that way, or do most/all companies require multiple language proficiency? (I suppose this isn't exactly a Python problem, either. I'm sure even companies that don't use Python still use multiple languages. Maybe it isn't a good idea to focus entirely on a single language, depending on the job at hand.) I am not really a programmer by training (though I spend most of my working time programmer, doing stats and bioinformatics), but when I look at a CV, I do not like to see just a single language, because that means your perspective and views of programming can be very narrow (I know a few bioinformaticians, who only know Perl, who think that hash tables are a Perl thing). It could also mean that some classic books in programming (such as Programming Pearls, or The practice of programming) could sound completely foreingn. And I think it is unlikely that Python will really solve _all_ of your programming needs. (I mean, don't you ever find the solution is easier to obtain with a one line awk or sed call than with Python? Or, if you do stats, would you reprogram a whole glm in Python instead of just using R? Or ...) If I remember correctly, The pragmatic programmers book recommended that a programmer learn a new program each year. The piece Teach yourself programming in ten years (http://www.norvig.com/21-days.html) has some very interesting comments, further references, and comments on other languages. HTH, R. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Embed Python in HTML?
On 9/25/06, Sean Hammond [EMAIL PROTECTED] wrote: Forgive my ignorance, but I sometimes write custom dynamic web-pages using PHP, by simply embedding PHP in HTML with ?php ? tags, and renaming for example index.html to index.php and making it executable. I only use this for very minor things like calling a script, and don't really want to learn any more PHP as it looks awful. So I was wondering, is it possible to throw together dynamic web pages like this using Python or other languages? If so, can anyone point me to any relevant tutorials, references or other info? Dear Sean, You have _lots_ of choices. Many web frameworks provide exactly what you want, and then some. And I guess what could make your choice harder is deciding how much of that some you want. I'd start going over: http://wiki.python.org/moin/Templating (or http://wiki.python.org/moin/WebProgramming for broader stuff). Best, R. Thanks -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Help me use my Dual Core CPU!
On 17 Sep 2006 00:55:09 -0700, Paul Rubin http://phr.cx@nospam.invalid wrote: Ramon Diaz-Uriarte [EMAIL PROTECTED] writes: You might also want to check http://www.lindaspaces.com/products/NWS_overview.html52 by the guys who invented Linda. Cool, I guess. I've only played a little bit with it, but it does certainly look nice. Nick Carriero (from network spaces) also developed a similar thing for R, the GNU S statistical programming language (also from the above url), and the demonstration I saw of it was _really_ impressive. I looked at these. Oz/Mozart is a whole nother language, worth examining for its ideas, but the implementation is quite slow. Yes, that is true. On the plus side, though, the Concepts, techniques, and models of computer programming book, by Van Roy and Haridi, uses Oz/Mozart, so you get a thorough, pedagogical, and extended ---900 pages--- tutorial of it. But the speed and, so far, limited ways of being friendly to other languages, can be show stoppers. Kamaelia doesn't attempt concurrency at all. Its main idea is to use generators to simulate microthreads. Candygram is a module that lets you write code in Python that's sort of like Erlang code, but it uses OS threads for the equivalent of Erlang processes. That misses the point of Erlang pretty badly, which is that processes are extremely lightweight (i.e. normally they are microthreads) so you can have millions of them active simultaneously (e.g. one for each active telephone connected to a big phone switch). Thanks for the clarification (I had only cursorily looked at them). Right now I want to check out GHCI (the Glasgow Haskell compiler), which may be the closest thing to a winner: - very advanced language, even higher level than Python, once described by somebody as what Python should have become - native code compilation - lock-free concurrency using software transactional memory (STM) Thanks for this. I'll check it out!! Best, R. -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for the Perfect Editor
On 9/15/06, David J. Braden [EMAIL PROTECTED] wrote: Wildemar Wildenburger wrote: (...) jEdit is extensible though java, and with the jython plugin also through python. Thanks. That helps me get a sense of the landscape. As an emacs user, this is a clear plus for JEdit (and for vim, for that matter). Very much so, and many thanks. My only languages are C and VBA, and the environments of R and Mathematica (hey, I'm ancient). If the R you refer is the statistical environment, GNU S, then you probably want to check Emacs (with ESS): you get an integrated environment where you can edit code, submit code pieces (lines, regions, buffers, functions, etc) to a running R process (which looks like another Emacs buffer), opening R help in another buffer (with the possibility of executing the example in the R process), clean up a transcript of an R session to keep only the code, etc, etc, etc. Moeover, you get a smart edition of Sweave (noweb literate programming), where emacs knows when you are in a LaTeX part and when you are in an R code chunck. Alternatively, in the Windoze world, you might want to check Tinn-R, which, regarding R, provides some similar functionality, and I think it is also very nice for Python, LaTeX, etc. HTH, R. -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for the Perfect Editor
On 9/15/06, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Ramon Diaz-Uriarte wrote: - I was referring to executing arbitrary sections of a Python file in a Python interpreter in an integrated way. When I tried JEdit, I think that Jython was the way to go. (And I think this was also the case for a while, at least to judge from D. Metrz's review http://www-128.ibm.com/developerworks/library/l-cpyide/ The console plugin (probably THE most useful of the pack) gives you a system shell and means to start compilers/interpreters based on your But isn't this a generic console: you go to the console, and then type python2.3 or python2.4 or whatever? How do you send arbitrary selections of Python code from the file you are editing to this shell? Is there a way to mark a section of code and have it evaluated by the python interpreter? Or a function definition? Ahh, I see. Well, you're right, that is not that easily possible. But you know what? I've never missed such functionality; the if __name__ ... trick always sufficed for me. Buts thats taste of course, lets not debate that. Thanks for the clarification. (And no, I won't debate that: the choice of editor is (and should be) very much a matter of personal taste, and JEdit is certainly a very fine and interesting editor). Best, R. -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for the Perfect Editor
Sorry, I could not resist, since almost every editor under the sun has been suggested as the solution, but (X)Emacs only got a minor mention. On 7 Sep 2006 13:18:22 -0700, Omar [EMAIL PROTECTED] wrote: I'd love the perfect editor that would be: a) free Emacs does of course qualify here. b) enable me to drag and drop code snippets from a sort of browser into the code piece of cake; either using shortcuts (wich you can configure) or from the Python menu c) can run programs right from within But of course. And, contrary to some others (e.g., JEdit, which I think forces you to use Jython, so you are stuck with Python 2.1 for now) you use the current python interpreter you have installed. And you can run Python, but also many, many, many other things as well. (For instance, for me it is of great importance that I use an almost identical way of working when editing/executing Python as when working with R, and very similar to what I do with LaTeX, C, etc). d) can edit Emacs can edit (almost) anything. With syntax highlight and bells and whistles: - PYTHON Yes, of course - Javascript I think so (but I stay away from JS) - HTML Yes - actionscript (since I'm also learning flash) No idea e) easy to learn Well ...that depends on what you mean and on so many other factors (I mean, why should it be Ctrl-O for open instead of Ctrl-X Ctrl-F?) ... but honestly, Emacs is probably harder to learn (at the beggining) than JEdit, or SPE, or UliPad, or Scite, or Eclipse. I've tried all these others, always to return back to Emacs. Because Emacs is a general purpose editor, and then some: I find it a lot more flexible and powerful than any of the alternatives suggested so far. However, the initial barrier might be too high (keybindings are sometimes an issue, but there is CUA mode, though I've never used it), and Emacs is so huge that you never really learn it all (and that might lead to feeling overwhelmed). And needing emacs lisp for extending/configuring, well, many people (including myself) do not find ideal. However, as has been mentioned here before, choosing an editor is a very personal thing, where idiosincratic issues can (and should) play a role. I'd suggest you play with a few, then go for one or two, and make a point of learning it well: if you spend a lot of time editing code, learning your main tool is of paramount importance and will definitely increase your productivity. I think many of the ones mentioned here (including, but not limited to, SPE, JEdit, UliPad) are very fine editors. Best, R. P.D: Another very nice editor, which can be extended using Python, is vim. (But I have little experience with it.) suggestions? -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Help me use my Dual Core CPU!
On 9/13/06, Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Cameron Laird wrote: Tim Golden [EMAIL PROTECTED] wrote: (...) | other types of concurrency which I might be able to use. I really like | the PyLinda approach (...) . Me, too. I'd love to talk over Linda with other aficionados, and/or hunt together for an excuse to use her/it. Funny you should mention that. I've had PyLinda opened in firefox for a couple days waiting to be read about. I have a large distributed system I'm hoping to use PyLinda for, or at least I hope PyLinda will help me with. You might also want to check http://www.lindaspaces.com/products/NWS_overview.html by the guys who invented Linda. (The Oz language/Mozart system is a good example of a different and very neat approach to concurrency; somewhat similar Python solutions can be found at Kamaelia and Candygram. Links and other stuff at: http://codepoetics.com/wiki/index.php?title=Topics:CTM_in_other_languages#Concurrency_in_Python ) -- Ramon Diaz-Uriarte Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Building Python Based Web Application
On 9/8/06, James Stroud [EMAIL PROTECTED] wrote: Hello All, I am interested in setting up a modest invoicing system for some consulting I am doing. I like the idea of managing this on the web and creating invoices and printing them from a browser. However, I'm not really sure where to start. I've played with some CMS applications, but they seem more for blogging (mamba, wordpress, etc.). Ideally, I would like to interface with mySQL (or whatever the favorite web-flavor database app is these days). I would like to be able to use my python skills. I confident that if I set out to write this from scatch, I will be seriously re-inventing the wheel, perhaps several times over. So, my question is, does anyone know of a book and/or some kind of framework that would make the best sense for what I am describing here? I've heard of Zope, but I would like to make sure its appropriate for the job before I spend 2 or 3 days getting acquainted with it. I'm adept at HTML, python, CSS, python-CGI, and interfacing with mySQL through DBI. I'm sure I could get something to work with these skills, but I want to minimize wheel re-invention as much as possible. Basically, I want a jump start on data-base oriented web development with a focus on applying my python skills. I think that Karrigell might do what you want, and you can read all the (excellent) documentation in a few hours. Otherwise, specially if you think you might get deeper into web-based stuff, with more complex/special/whatever needs, I'd probably try Pylons (which has also very nice and well organized docs). I have no direct experience with Django or TG, but I find them overwhelming, specially compared to Karrigell; Zope I find even more overwhelming. HTH, R. -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/116 -- http://mail.python.org/mailman/listinfo/python-list117 -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Program to backtrack function calls in source code?
On 2 Sep 2006 13:53:21 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Dear Anton, Is there a program that can extract all place in the source code where a variable is accessed or a function called? I've been dealing with these issues lately too. You might want to check pypesrc (http://www.jimbrooks.org/web/hypersrc/pypersrc.php). Alternatively, and especially if you want to use these utilities from vim or emacs, and want support for other languages in addition to Python, you can use exuberant ctags and idutils (I've just added some python support to idutils). I have some additional information on these issues at http://ligarto.org/rdiaz/idutils-et-al.html. HTH, R. -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Python web service ...
On 26 Aug 2006 04:07:35 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi folks, I have accomplished to make a python program that make some image manipulation to bmp files. I now want to provide this program as a web service. A user can visit a site and through a web interface he should upload the file to the web server , the server then will do the image process with the python program I have wrote and when it finish the user must get the image file back . My question is how difficult is to set up a web server that can run python easy ? should I try ZOPE or there is something better in mind ? For a one-shot thing, plain old CGI might be enough. You can have a static HTML page with the form for the upload, have python do the image part, and generate the return HTML with the image with a python script. If you plan to do this a lot, or want fairly sophisticated stuff, or DB access underneath, authentication, etc, then you might want to look at any of the web framewoks. If you don't have the web server part already taken care of (e.g., you already have Apache up and running) then the web server framework can be more attractive. As for web frameworks there is a long list in the Python web site. Which framework fits you best might depend on what you want to accomplish now and in the future. You can try something simple and minimalist (and with docs that you can read in less than an afternoon) such as Karrigell, or try something more complex, such as Django, TurboGears, Pylons, CherryPy, etc. And then, you might try the CGI approach to begin with, and as your needs become more complex, move to a framework. (This has been our own path: we've used plain CGI for over a year for the web-based bioinformatics applications we've developed, that use R and Python for computations, and are now moving to framework). Good luck! R. -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: Python web service ...
On 26 Aug 2006 09:12:50 -0700, NicolasG [EMAIL PROTECTED] wrote: For a one-shot thing, plain old CGI might be enough. You can have a static HTML page with the form for the upload, have python do the image part, and generate the return HTML with the image with a python script. If you plan to do this a lot, or want fairly sophisticated stuff, or DB access underneath, authentication, etc, then you might want to look at any of the web framewoks. If you don't have the web server part already taken care of (e.g., you already have Apache up and running) then the web server framework can be more attractive. As for web frameworks there is a long list in the Python web site. Which framework fits you best might depend on what you want to accomplish now and in the future. You can try something simple and minimalist (and with docs that you can read in less than an afternoon) such as Karrigell, or try something more complex, such as Django, TurboGears, Pylons, CherryPy, etc. And then, you might try the CGI approach to begin with, and as your needs become more complex, move to a framework. (This has been our own path: we've used plain CGI for over a year for the web-based bioinformatics applications we've developed, that use R and Python for computations, and are now moving to framework). Good luck! R. -- Ramon Diaz-Uriarte At this time right now I prefer to do something that works the quickest possible... I never had any experience with CGI, do I need to set up a web server for that ? Yes, you'd need to configure a web server. I don't know whether you are on windows or Unix/Linux, and that could seriously affect how easy it is to set up a web server. Most Linux distros make installing apache a piece of cake, but configuring Apache might not be trivial. Thus, maybe the fastest and easiest is, as other posters have suggested, to try Karrigell. can you point me some usefull reading material so I can get a start ? I will post for a comment at Zope , I had installed once and it was very easy. Don't know if it will be easy too to get my job done... But Zope seems to have a steep learning curve and it is a big system. It might be a huge hassle for what you want. Best, R. -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie programmer question: How do parsers work?(Python examples?)
On 25 Aug 2006 12:55:26 -0700, bio_enthusiast [EMAIL PROTECTED] wrote: I was wondering exactly how you create a parser. I'm learning Python and I recently have come across this material. I'm interested in the method or art of writing a parser. If anyone has some python code to post for an abstract parser, or links to some informative tutorials, that would be great. -- http://mail.python.org/mailman/listinfo/python-list145 A very nice module, with many links for extra info: http://pyparsing.wikispaces.com/ -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: idutils and Python
On 22 Aug 2006 10:04:12 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: That's usually cscope http://cscope.sourceforge.net/ but I've not tried to use it with Python before; from the web page it looks like it may be worth a spin: The fuzzy parser supports C, but is flexible enough to be useful for C++ and Java, and for use as a generalized 'grep database' (use it to browse large text documents! Thanks for your answer. I'll take a new look at cscope (I think I looked at it, but discarded because it seemed to focus on C/C++; never noticed it is possible use as a general browser for large text collections). I am usually happy with grep, but we only have a medium-large size project (320,000 lines of Python code); I can imagine on very large codebases that would be too slow to be practical. I am generally happy with grep (and your code is much larger than ours) but idutils' output offers both that and, by showing all together, a kind of poor-man's static call graph, and can be of use when refactoring. Thanks again, R. On 22 Aug 2006 10:04:12 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ramon Diaz-Uriarte wrote: On 21 Aug 2006 22:56:13 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: What exactly are you trying to accomplish? If you want to index function/class names, variables, etc then you should take a look at exuberant ctags http://ctags.sourceforge.net53 --although it started off as a C indexer, it has excellent Python support, it's free, and as a bonus its indices are well supported from inside major editors (vim, emacs, etc) so you can easily follow code flow, find function/class definitions, etc. Sorry for not being clear enough. I want the following: a) have my editor go to the point where a function/whatever is defined That's usually ctags/etags b) see all places where a function/whatever is used. That's usually cscope http://cscope.sourceforge.net/ but I've not tried to use it with Python before; from the web page it looks like it may be worth a spin: The fuzzy parser supports C, but is flexible enough to be useful for C++ and Java, and for use as a generalized 'grep database' (use it to browse large text documents! The vim integration is very nice. It has emacs integration too, but I haven't used it and can't comment on how good it is. I think the wish do not use grep, just look at the index file, and immediately display all matches is reasonable and probably other Python coders had thought about it before. But I am wondering if I am missing something obvious, as most people seem to be very happy with exuberant ctags. I am usually happy with grep, but we only have a medium-large size project (320,000 lines of Python code); I can imagine on very large codebases that would be too slow to be practical. -- http://mail.python.org/mailman/listinfo/python-list -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: idutils and Python
Thanks for the answer. I had read about PyDev and its extenssions but, if at all possible, I'd like to keep working with Emacs (or Vim) instead of Eclipse, and I'd rather use free/open source software. Best, R. On 8/23/06, Fabio Zadrozny [EMAIL PROTECTED] wrote: What exactly are you trying to accomplish? If you want to index function/class names, variables, etc then you should take a look at exuberant ctags http://ctags.sourceforge.net53 --although it started off as a C indexer, it has excellent Python support, it's free, and as a bonus its indices are well supported from inside major editors (vim, emacs, etc) so you can easily follow code flow, find function/class definitions, etc. Sorry for not being clear enough. I want the following: a) have my editor go to the point where a function/whatever is defined Pydev Extensions (http://www.fabioz.com/pydev) should do that without any problems with F3 (it first tries a 'context-sensitive' match, trying to find it in locals, globals, current class, etc and if not found like that, it goes and looks for the signature in a context-insensitive way, as if it was a simple text-search) b) see all places where a function/whatever is used. This can be handed pretty well with the search that is builtin into Eclipse (ctrl+h). Cheers, Fabio -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
Re: idutils and Python
On 21 Aug 2006 22:56:13 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: What exactly are you trying to accomplish? If you want to index function/class names, variables, etc then you should take a look at exuberant ctags http://ctags.sourceforge.net53 --although it started off as a C indexer, it has excellent Python support, it's free, and as a bonus its indices are well supported from inside major editors (vim, emacs, etc) so you can easily follow code flow, find function/class definitions, etc. Sorry for not being clear enough. I want the following: a) have my editor go to the point where a function/whatever is defined b) see all places where a function/whatever is used. I've tried exuberant ctags and I do like it a lot. a) is done wonderfully (within emacs, the editor I use, but also in other editros, from what I've read). However, b) does not work exactly as I'd like: 1. With Emacs and tags: using tags-search I can visit, one by one, all places where a function is called, but I'd like to see where it is called before visting that file and know, before visiting each file in turn, whether I'll visit 1 or 20 files (or, to put it in another way, I'd like to see like a poor-mans static callgraph). 2. From what I understand, there is a deeper difference than just how results are shown: the tags file contains the places where, say, a function is defined, but finding where it is used requires running grep on every file looking for the tag. (I believe that is what tags-search does in emacs). In contrast, ID utils does not do any grep, but directly goes to the ID file, where all that is already pre-stored, which also means that it will be a lot faster than grepping for the tags. A tool similar to IDutils is Global http://www.gnu.no/software/global/, but it also does not incorporate Python support. (Though defining other parsers might be simple; I haven't looked at it closely). I think the wish do not use grep, just look at the index file, and immediately display all matches is reasonable and probably other Python coders had thought about it before. But I am wondering if I am missing something obvious, as most people seem to be very happy with exuberant ctags. Thanks, R. On 21 Aug 2006 22:56:13 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ramon Diaz-Uriarte wrote: Dear All, Has anybody tried to use ID Utils (http://www.gnu.org/software/idutils/4652) with Python? What exactly are you trying to accomplish? If you want to index function/class names, variables, etc then you should take a look at exuberant ctags http://ctags.sourceforge.net53 --although it started off as a C indexer, it has excellent Python support, it's free, and as a bonus its indices are well supported from inside major editors (vim, emacs, etc) so you can easily follow code flow, find function/class definitions, etc. -- http://mail.python.org/mailman/listinfo/python-list54 -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list
idutils and Python
Dear All, Has anybody tried to use ID Utils (http://www.gnu.org/software/idutils/46) with Python? I've googled, searched the mailing list, and have found nothing. A silly, simple use of IDUtils with Python code does work, using a language map that says *.py files are text files. But I am wondering if someone has done something more sophisticated. (For instance, I get matches to commented out functions, which I'd rather not, lots of extra stuff is indexed which probably shouldn't, etc). Thanks, R. P.D. ID utils is somewhat like [ce]tags, and has support under Emacs (see section 5.2 of the ID utils manual: http://www.gnu.org/software/idutils/manual/idutils.html#Emacs-gid-interface47 ). One nice feature is that, when searching for matches, it shows the results in a compilation buffer, so you can see where, in each file, the identifier is used, and visit that if you want. I like this a lot better than tags-search. -- Ramon Diaz-Uriarte Bioinformatics Unit Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz -- http://mail.python.org/mailman/listinfo/python-list