which is more useful in the real world? Python or C++...

which is more useful? Python or C++

  • Python

  • C++


Results are only viewable after voting.

Daniel Duffy

C++ author, trainer
MATLAB has 2 problems I think:
1. cost, it is not something you can just trial like you can with Python
2. its numerical data focus, doesn't work well with strings, etc, so it almost always needs to be supplemented
And an issue that gets overlooked: does Matlab help you in becoming a good programmer?
 
woah, where does that leave matlab? cause I'm really in that camp. it seems to be shunned by a lot of people -_-
Matlab as a language is going to go the way of the Dodo. The only reason you should be picking it up is probably inertia, the enterprise support they can offer, or in some specific areas, the toolboxes.

The base language is closed; Python with NumPy/SciPy and more recently Julia have really shown that open source can compete in this area. The odds are stacked and not in Matlab's favor.
 

pingu

Well-Known Member
And an issue that gets overlooked: does Matlab help you in becoming a good programmer?
I think that's besides the point. Unless you want to be a programmer, there is no need to be a good programmer, just good enough.
 

Daniel Duffy

C++ author, trainer
I think that's besides the point. Unless you want to be a programmer, there is no need to be a good programmer, just good enough.
Maybe. Depends on the context.
Once the basic functionality of a system has been realized you get into system maintenance mode which is much more co$tly to keep the software up and running. The number of real lines of code peer week (10-20?) slows down and small enhancements and bug fixes take over.

For throwaway prototypes this is probably not an issue but for projects with xx years lifespan a professional software process is probably advisable.

Is a 'good enough programmer' good enough for medical equipment development?
 

Daniel Duffy

C++ author, trainer
<QUOTE>

But nowadays almost all the productions trading systems as well strategies are written in C/C++ when low latency system performance is required.
 

vertigo

Member
C++ is the better language, Python is more useful. From 'easiest to use' to 'most difficult use' i would go

VBA > R > Python > MATLAB > Java > C++

It is worth learning VBA and one of R/MATLAB/Python and one of Java/C++. Java is easier to use than C++ and is fairly fast.

For quantitative analysis work, Python is sufficient. To build a proper model though, one should use Java/C++. Trading systems, internal models used in banks, etc, are all coded in Java/C++ (or some variant).
 

tfors

Active Member
Also one should not forget that with some simple easy tricks python is usually equally fast (or faster) than C++ on numerical computing. Writing your functions with the Numpy package and using explicit loops instead of vectorizing, adding Numba decorations is usually enough to get blazing-fast results. Of course this only works when you write your functions from scratch (the most used vectorized operations from numpy are supported though).
 
Last edited:

Daniel Duffy

C++ author, trainer
I have just ported some C++ code to Python for PDE + Method of Lines + scipy.odeint for Black Scholes so as to get some hands-on feeling. Some initial impressions:

  1. The code is easy to port (algorithmic code is almost 1:1).
  2. I find Python 'layout' style quite quirky. Reminds me of Fortran IV in some ways.
  3. Very easy to prototype 'proof of concept' algorithms.
  4. The run-time code is inefficient (BTW I have not tried to optimize the code, even then it is not clear how I would do this).
  5. Looking into crystal ball and extrapolating: large Python code base will in all probably be difficult to maintain and/or reuse. But maybe this is not one of Python's goals.
  6. Using Python is an effective means to learn PDE/FDM and more generally, numerical algorithms.
Now I see why Python libraries wrap Fortran/C/C++ code.
 
Last edited:

pingu

Well-Known Member
I have just ported some C++ code to Python for PDE + Method of Lines + scipy.odeint for Black Scholes so as to get some hands-on feeling. Some initial impressions:

  1. The code is easy to port (algorithmic code is almost 1:1).
  2. I find Python 'layout' style quite quirky. Reminds me of Fortran IV in some ways.
  3. Very easy to prototype 'proof of concept' algorithms.
  4. The run-time code is inefficient (BTW I have not tried to optimize the code, even then it is not clear how I would do this).
  5. Looking into crystal ball and extrapolating: large Python code base will in all probably be difficult to maintain and/or reuse. But maybe this is not one of Python's goals.
  6. Using Python is an effective means to learn PDE/FDM and more generally, numerical algorithms.
Now I see why Python libraries wrap Fortran/C/C++ code.
Great Daniel! I'm glad you are giving it a try.

  1. This is usually what you are going to do at the beginning. I used to do that until I started to think more like a python developer
  2. The layout has some getting used to it. You will see that it's an advantage
  3. Biggest advantage
  4. Performance in Python code usually sucks on the first try unless your mindset changes. Eventually it gets better but it's no C++. Eventually you end up mixing Python with high performance implementation thing (Cython, C/C++ via CFFI or Boost or whatever, etc)
  5. In my experience I have seen the opposite, at least in comparison with C/C++.
  6. I agree
 

Daniel Duffy

C++ author, trainer
Nice
I think in maths and Python, C++ are two reallisations. I don't necessarily want to thinks as a Python programmer in that sense. They are tools and not thought processes. The maths drives the code as it were.
As I mentioned, Python really helps with learning the maths. Some of my MSc/MFE students use my C++ book to produce Python code for PDE and this speeds things up no end.

Anyways, pingu, I've been converted :)

IMO the questionnaire could be any of 1 of 3

  1. Python
  2. C++
  3. Python and C++
 
Last edited:

Daniel Duffy

C++ author, trainer
How easy it is to interface Python <-> Excel? For example, worksheet function, COM addins?
 

Daniel Duffy

C++ author, trainer
Stupid question; I installed pip install xlwings in VS2015 but module "xlwings" not found

import xlwings as xw

Am I missing something? (wrong version or add a reference?)
 

APalley

Well-Known Member
Stupid question; I installed pip install xlwings in VS2015 but module "xlwings" not found

import xlwings as xw

Am I missing something? (wrong version or add a reference?)
For Python dev I strongly recommend PyCharm over VS. Among other advantages, package management is much simpler.
 

pingu

Well-Known Member
Stupid question; I installed pip install xlwings in VS2015 but module "xlwings" not found

import xlwings as xw

Am I missing something? (wrong version or add a reference?)
There are no stupid questions. I'm not sure how VS2015 calls pip but it should've found it if you did the usual pip install.

One more detail, I will use the Anaconda Python distribution. It's very stable and tailored for scientific computations.
 
Top