![]() ![]() And/or if you happen to be a stronger programmer in something else, hopefully you stumble across perlcritic and modern perl patterns more quickly. But it really doesn't take much to produce good code if you have a tiny bit of supervision/discipline (which stems mostly from 80% of perl tutorials on the web are teaching 1997-era perl anti-patterns). It's true that unsupervised, weak coders using perl turn out worse code than in other languages. I don't know why I always have to chip in on "perl is unreadable lol" comments, but over the last 8 years apart from a steady trickle of C coding here and there the bulk of my dayjob has moved around from C/Verilog, then I discovered Ruby, then Perl/R/Python, to full-time Python now. The striking thing was that unlike Java (say) where it can be fast but you generally have to think about it, I was getting fast Perl without even really trying. I abandoned Perl for Python shortly thereafter because once I got over the "oh my god it's full of whitespace" thing Python was just more fun to code in, but the speed that Perl provided is something I've definitely missed, and it was a real awakening to the notion that interpreted languages don't have to be slow. Perl's scalar types have vastly less overhead, so much so that you can actually do reasonably efficient numerical computation in it. It really does seem to come down to the Python object model. So it isn't that "Python is interpreted" that is the problem, because "Perl is interpreted" in exactly the same way. I re-wrote everything in C++, and picked up less than a factor of two in speed. The equations of motion had to be integrated over a very long time, and it could take hours for a single run (still much faster than the Monte Carlo it was being used to do a sanity-check on). ![]() Quite a few years ago I wrote a little Runge-Kutta solver in Perl for some simulation work. The elegant design of Python minimizes this problem and lets you create nicely built scripts.ġ.Perl is a lot older than Python and has a much wider selection modules available.Ģ.Perl uses the traditional braces to mark statement blocks while Python uses the indentation for the same purpose.ģ.Python code is intuitive and easier to learn compared to Perl.Ĥ.Perl is harder to handle and debug compared to Python when the code starts to grow.A related question is: why is Perl so fast? It would be a lot more difficult to debug Perl code than Python code as your programs get bigger as the minor problems that seems trivial at the beginning gets amplified more and you end up struggling with your own code. This problem might not seem very relevant when you are coding small programs but as you start going into bigger programs that needs a lot of code.Īs it gets more difficult to write code for bigger programs, it also follows that errors in code are very likely to appear. Perl can be a bit complex and confusing as the keywords that you need often don’t actually correspond to the task you had in mind. Python is also more intuitive when it comes to the code and a lot of experts say that Python is easier to learn and pick-up even for beginners. Changing indentations for every new block is already a common practice for most programmers and the makers of Python saw the braces as redundant. Python breaks convention by using the change in indentation to indicate the start or the end of the block. This is the norm for programming languages and most use the same or some other character. In Perl, braces are used to group statements together into a unified block. The thing that you would easily notice when looking at Perl and Python code is the lack of braces in the code of Python. In contrast, Python is relatively new but it has garnered a lot of attention due to its unorthodox way of doing things. Because of the maturity of Perl, you can find and download a lot of modules that were created by the Perl community. ![]() Perl is already an old established scripting language that has garnered wide support due to its comprehensive collection of UNIX libraries. Perl and Python are both scripting languages that are meant to produce little scripts that can be used for different applications. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |