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
Yeah, I did pip install indeed. Ok, Anaconda will be next, but VS is already set up and I'm sure it's a small issue..
 

pingu

Well-Known Member
It could be that VS is looking at a different python interpreter than the one you pip-installed xlwings into. The usual approach is to have a virtualenv with the necessary packages installed and telling VS where to look for it. I haven't used VS before (I'm a PyCharmer as well), but this page might point you in the right direction for VS: How to create and manage Python environments in Visual Studio
If you decide to go the Anaconda route, use conda environments:

 

David.Wan

Member
C++ Student
Python is a great language, especially for recent years open source development which greatly enlarge the community of this language. Even now stable system is also possible to be implemented in Python.

However you have to change your mindset when you program in python. For example, always avoid loop and take advantages of the numpy array for SIMD instruction. (it will be faster than your loop in C++. try it yourself)... Basically all these packages in Python are wrapping all these famous fortran/C/C++ packages such as nlopt and blas whcih were writen by numerical experts for decades and there is no way you can write codes faster than that in C++. If you think you can do better don't fool yourself...

Coding in numpy is like coding in Q(the language for KDB). It is just so convenient, interface friendly and fast. Unfortunately I hope they can improve the performance of Pandas, which is still much slower compared to Q sql.

C++ still has its own use. If your analytic happens to require a lot of abstraction, composition, i.e extremely object oriented. C++ is still better. Not everything can vectorized. Not saying that Python can't do it. It can still do the trick but performance is not as good for this kind of purpose.

Well, pick the best tool for the specific problem you are tying to solve.
 

Daniel Duffy

C++ author, trainer
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.
I see it is for Python 3.7. Do I need to update from Python 3.6 under VS2017 or is it a separate implementation?
BTW pip is not needed; I just type xlwings etc. directly in the panel.

Also installed anaconda, keras, TensorFlow under VS2017 and no glitches to date!
 
Last edited:

Daniel Duffy

C++ author, trainer
One possible use (still have to examine) is to have something similar to the Excel Driver in the QN C++ course. I like using it because we can visualize output from numerical methods in a user-friendly way. The plotting libraries in Python are OK for quick visualization but Excel stores data in essentially database format.
 

tfors

Active Member
Also numba package can be very useful for speed equal to C++ code. Just use loops as you would in C++ over numpy arrays with @(nopython=True) superscript. I used it a lot in my comp fin course assignments. (scipy is not supported though)
 

Viraj Bhagat

New Member
If you're looking from the point of view of Salary, I'd say Python. (An old infographic that I had)

From the future ready point of view, again Python: Programming language of the year? Python is standout in latest rankings | ZDNet

28397


Being from the domain of Algorithmic Trading, reputed institutes like Quantra and QuantInsti are also rooting for Python, as can be witnessed in this course on Python)

I find it relatively easy to use Python in my daily tasks and even owing to the fact that it is relatively better to learn, practise, implement, etc.
 

pingu

Well-Known Member
If you're looking from the point of view of Salary, I'd say Python. (An old infographic that I had)

From the future ready point of view, again Python: Programming language of the year? Python is standout in latest rankings | ZDNet

View attachment 28397

Being from the domain of Algorithmic Trading, reputed institutes like Quantra and QuantInsti are also rooting for Python, as can be witnessed in this course on Python)

I find it relatively easy to use Python in my daily tasks and even owing to the fact that it is relatively better to learn, practise, implement, etc.
Being from the domain of Algorithmic Trading, reputed institutes like Quantra and QuantInsti? I'm not sure what your definition of "reputed" is. I have never heard of them in Financial circles or Algo trading circles or HFT circles. If they teach, they probably don't have PnL to deal with unless that P&L comes from teaching which is another matter all together.
 

Daniel Duffy

C++ author, trainer
Looks like spam from the marketing dept. from a poster with in total 3 posts.
These are very annoying.
 

Daniel Duffy

C++ author, trainer
I think it is a bit silly to compare Python with C++.
All new technologies become commoditized in time and lose their competitive edge.

Anyone brave enough to say how the Python landscape will look like in 5 years time, say?
 

Daniel Duffy

C++ author, trainer
A small note: some of us tested Crank Nicolson versus ADE on a CIR Pde model (normally ADE is about 30-40% faster in C++). However, ADE is 40 times slower in Python. ADE uses 'native'/naïve loops which is probably the reason and CN uses optimized loops?
 

ExSan

Active Member
I think it is a bit silly to compare Python with C++.
All new technologies become commoditized in time and lose their competitive edge.

Anyone brave enough to say how the Python landscape will look like in 5 years time, say?
Very few talk about C#
 

tfors

Active Member
A small note: some of us tested Crank Nicolson versus ADE on a CIR Pde model (normally ADE is about 30-40% faster in C++). However, ADE is 40 times slower in Python. ADE uses 'native'/naïve loops which is probably the reason and CN uses optimized loops?
Did you iterate over numpy arrays in a loop in ADE, such as:
Python:
sum = 0
for i in range(array.shape[0]):
    sum += array[i]
This is very slow in python.
Either use numba
Python:
from numba import jit
@jit(nopython=True)
def get_sum(array):
    sum = 0
    for i in range(array.shape[0]):
        sum += array[i]
    return sum
or
Python:
sum = array.sum()
 
Top