I'm afraid this is ~ 10-15 years too late.
I've used PDL somewhat in ~ 2005-2010 when python didn't have that many packages/numpy, and it did the job and could substitute IDL to some degree. But realistically, right now I don't see any reason to use PDL instead of Python.
Meh… Python zealots abound. Folks often say the same thing about Fortran but frankly, those are the engines that power ALL scripting languages math features. You’re running on C/C++/FORTRAN. If one needs better text-parsing features on top of that: use Perl; if you use a Python environment: use Python.
Perl is superior in many ways and I think using it for data-exploration still has tons of merit.
Folks “shoot themselves in the foot” when they don’t understand the language. In Perls case: list/scalar context is usually the culprit, but it is quite easy to understand. It’s more flexible and concise which in many ways makes Perl better at exploratory programming.
I (and many in science) switched from C/PDL/IDL to Python in last 10 years because it was is the best tool, not for zealotry.
Python vs Perl for science has nothing to do with c/c++/fortran. C/C++/fortran have their own place for science computations. Perl does not.
For anything involving any kind of numerics Python will be faster/better tested/will have more libraries/will have better visualisation capabilities, so there is no need for perl.
Sure if you are only working with strings, you can use perl, but that's hardly scientific computing (not at least the field that I work in).
> if you are only working with strings ... that's hardly scientific computing
It depends on the field. RNA/DNA, Polypeptids and proteins are just long chains of text, therefore Perl can deal easily with the problems of finding things, manipulating them to build a new chain or translating the chain to a different format. This is a significant chunk of what Bioinformatics do all the time, and Bioperl can manage it.
Also a big part of astronomy is analyzing or finding stars in a tridimensional matrix of space. PDL can be useful with that. Is not dificult to extract a slice of interest in the space matrix and focus our research on it. The main problem could be the lack of experienced people available having exactly this problem to solve.
I don't know if original Perl is very good or bad for that, but there are several Math modules that could have what you want and be easily connected with the former stuff. In fact there are a lot of them to choose:
Raku at least has a Math::Model module to simulate Physics stuff. I ignore how developed is the module or how its perform would compare with Pyton's similar stuff
> In Perls case: list/scalar context is usually the culprit
That’s just the surface. Working with matrices means nested data structures, and Perls syntax for nested data structures makes the list/scalar context look like child’s play.
I'm no Perl lover (spent many years programming on codebases far larger than they ever should have been allowed to grow before switching languages), but what's so hard about references? Definitely not one of the sharper edges in the language IMO.
Python has just one way to use list and dict and they are always passed by reference, but in Perl it can be either array/hash or arrayref/hashref. More options requires more thinking. Also Perl recently (in 5.20) introduced postfix dereference syntax which means that enough people were unhappy with existing ways to dereference. But it adds one more straw on camel's back - makes syntax harder to learn which is already a frequent complain about Perl.
Having said all than I have no problems using references in Perl, but see why a Pythonista can find Perl code hard to read.
The question isn't about Perl vs Python (which I still think is a clear winner for Python, although there are some uses where I could perfectly understand reaching for Perl first).
The question is whether Perl's PDL is better than ScyPy/Numpy/Pandas/Cython, the Spyder IDE, bunch of plotting libraries...etc.
Indeed, I'm a scientific programmer, and I've noticed that when most scientists talk about "Python," they don't make a clear distinction between where the language ends and the libraries begin. If they even know. Most users, myself included, download some big installer like Anaconda or WinPython, and off we go.
Same. Obviously a OO scripting language by itself isn't fast enough for most scientific coding, but when the C/Fortran libraries are tightly integrated with lots of stats/plots and other libraries with great IDE/database...etc it makes for a great and free/open scientific modeling platform. It's really the whole package and the language is just 1 component of that.
Indeed, and it's my understanding that supporting that kind of integration is a strength of Python. Since I use Python in the lab, I've also found that the whole ctypes thing is a life saver when dealing with hardware drivers that are only furnished with a C API.
People like other people using python because it makes it easier to share and exchange and built a community of knowledge and libraries. Science is a lot about ease of collaboration.
The fact is that most people don't even have an opinion about what is Python or Perl.
Python can seem easy to share after you copy part of a python script and miss one blank space somewhere at the end of a line or start copying in the wrong line. If you use a dumb text editor the script will easily turn into a ugly mess. Perl scripts don't have this problem, so some people could say that they are easier to exchange and share in fact.
Many Perl authors will be really glad to share your code with you. This is what they built an online community of knowledge and libraries called CPAN where you can find it easily. To find authors willing to help and explain obscure parts of their own scripts also if asked politely, is not uncommon or particularly difficult.
> part of a python script and miss one blank space somewhere at the end of a line or start copying in the wrong line. If you use a dumb text editor the script will easily turn into a ugly mess.
I think we can bury this 'Python has significant whitespace' criticism for good now. I have taught python to people from hugely diverse backgrounds (including literature and law) and not once has this been an issue (on the contrary it's a massive help to readability).
Also, no sane person teaches people to code python with a 'dumb' text editor - you give them Jupyter notebooks or VSCode or PyCharm (which has an excellent educational version) or Notepad++ or something.
I think that the comment that you relied to meant that it is easier for scientists to collaborate using a single language rather than many. For some domains, Python has emerged as that single language. That doesn't mean that Python is the best language.
Exactly this. To some extent the language doesn't matter - although I think Python has become especially popular thanks to being one of the easiest languages to learn and use in practice. Then you get lots of network effects - e.g. grad students learn python, and when they become supervisors they teach their students python.
You'd be hard pressed to find someone who only knows python, though. Where there is python data science there is usually also R, like smoke and fire. The syntaxes are similar enough, imo R a little simpler even.
>
People like other people using python because it makes it easier to share and exchange and built a community of knowledge and libraries. Science is a lot about ease of collaboration.
That's not the point, people are using python so when they work with other people, it helps if everyone is using python. Maybe CPAN was first but it never became standard in the science community.
> right now I don't see any reason to use PDL instead of Python.
I like python a lot and actually i wish less scientists used it. Perl/PDL is in my opinion much better suited to this (understandable) just getting the job done approach i often find in sciene or other areas in which writing software is not the primary goal.