[This article was first published on logopt: a journey in R, Python, finance and open source, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The previous post glossed about why I now prefer Python to write code, including for a module like logopt. This post explains in more details some specific differences where I prefer one of these two languages:Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
- 0-based indexing in python versus 1-based indexing in R. This may seem a small difference but for me, 0-based indexing is more natural and results in less off by one errors. No less than Dijkstra opines with me on 0-based indexing.
- = versus <- for assignment. I like R approach here, and I would like to see more languages doing the same. I still sometimes end up using = where I wanted ==. If only R would allow <- in call arguments.
- CRAN versus pypi
- CRAN is much better for the user, the CRAN Task Views is a gold mine, and in general CRAN is a better repository, with higher quality packages.
- But publishing one CRAN is simply daunting, and the reason logopt remained in R-Forge only. The manual explaining how to write extensions is 178 pages long.
- Python has better data structures, especially the Python dictionary is something I miss whenever I write in R. Python has no native dataframe, but this is easily taken care of by importing pandas.
- Object orientation is conceptually clean and almost easy to use in Python, less so in R.
- Plotting is better in R. There are some effort to make Python better in that area, especially for ease of use. Matplotlib is powerful but difficult to master.
- lm is a gem in R, the simplicity with which you can express the expressions you want to model is incredible
To leave a comment for the author, please follow the link and comment on their blog: logopt: a journey in R, Python, finance and open source.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.