• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Necessary to learn C#?

In TIOBE index is 2.6% penetration.
The TIOBE index is a poor measurement when you want to know about how good or even popular is a language in a quantitative field.

I expect python to grow in usage in general since it is now taught as introductory programming language in a wide range of colleges in the US.

In finance it has already made a mark. Two of the biggest investment banks in the world use python as the central programming language for their Risk Systems.
 
I do not see there is a point in arguing which language is better. They all serve in different purposes.
if you are doing HFT, go for C++/Java
if you are doing some UI in the front end, go for C#
if you are moving/downloading/webscraping files over the internet, go for Python
 
Thanks for asking a question then proceeding to completely ignore the answer.
Oh, I did not know I was to respond in a certain way. The TIOBE index says to me that Python has probably some way to go.

It is possible to pay the rent with a Python business versus C#?
 
Oh, I did not know I was to respond in a certain way. The TIOBE index says to me that Python has probably some way to go.

It is possible to pay the rent with a Python business versus C#?


Yes and more and more people are doing it all the time. Youtube is written in python... In finance, many hedge-funds now have significant python infrastructure, and many shops are moving from R/matlab to python for data analysis since the python libraries offer much better performance yet still with massively increased programmer productivity and the ability to write re-useable, generic code. I had a friend who recently had an interview at a big London hedge fund and the only thing they cared about was how much python he knew. In all honesty, if I didn't need anything other than very fast performance I would write every piece of code I could in Python. Since I rarely need maximum performance, it means I write almost all my code in python. It is so expressive that you can get a useful program working in fractions of the time it would take in any other language. The other day, I was given a 500 LOC C++ program by a colleague for reading an HDF5 file and doing some calculations on the data. Rather than spend weeks trying to understand it, I just re-wrote the whole thing in 50 lines of Python in a single afternoon. Doing it in C# or any other language would have been a nightmare for the task I had. IMO, Python's market share is only going to grow, particularly in quantitative fields. Matlab, R et al. have started a very slow, painful path to death now that python's scientific libraries are so advanced.

Check out, for instance:

General scientific computing: scipy/numpy
Scientific plotting: matplotlib
Time-series analysis and general data analysis: pandas
Machine learning: scikit-learn
Stats: statsmodels.
high performance i/o: h5py, pytables
 
Last edited:
Also, even in terms of high-performance computing, python is being used more and more. It is not as fast as C++, but if you want a highly parallel application you can use MPI bindings for python and there's decent OpenCL/Cuda libraries available, because in that instance scalability is more important than single core performance. In scientific research, the ability to do new things quickly and correctly is the most important factor. What good is a code that is achieving 90% of the theoretical FLOPS if you don't know the calculations it is doing are correct? I can see a shift in the scientific software community to open-source software, and when that happens the emperor will be left with no clothes and people will finally realise that many of the results obtained in computational physics over the last 20 years are complete crap due to some obscure bug buried in 50k lines of C code. Not too long ago a PhD student found dozens of bugs in a widely used MD program called Amber, because he went through and used python to methodically unit-test as many functions as he could. Of course, that could have been found with proper unit-tests in the first place, but in academia people do not value proper software engineering. Added to the fact that most people who work on these codes are PhD students. How long does it take to get proficient enough in C++ to be able to write proper, re-usable code in some open source software? I would suggests at least 3 years, which is the length of an entire UK PhD. Moving to languages like Python which people can understand and do useful things with in < 1 year is a positive move in that arena.

Of course, there are some applications where you really do need to get as many FLOPs as possible, and in those cases C/C++/Fortran are great. The thing is, very few codes and applications actually need that. Rapid development is usually a more important factor. C/C++ are good at some things, but not the best choice for most. In contrast, python is good for most things, and not the best choice for some.

Anyway, it seems I'm preaching to the choir here with quite a few python fanboys on quantnet. Now we just need to get that dinosaur Daniel Duffy to start cutting some python code :P:D
 
Last edited:
As a computer science undergrad student I would love it if Python would become standard. You are almost directly writing algorithms instead of dealing with the nitty-gritty of most other languages. (disclaimer: For larger/critical projects the nitty gritty can become useful sometimes though).
 
Python, C# and C++ are basically all the same; they are C with quiche. So, when you can design in a language-independent way I reckon it can also be done in Python. What about this MC pricer in Pyhton?

http://www.wilmott.com/messageview.cfm?catid=44&threadid=96115&STARTPAGE=1

Once you know what the equivalent functions in Python are then the port is simple.

BTW Barny, what Python book do you recommend? 24 hours, dummies etc. I know what variables and loops are so I can start with more advanced stuff.
 
Last edited:
@Daniel Duffy -- general lists:
https://wiki.python.org/moin/PythonBooks
http://www.reddit.com/r/learnpython/wiki/index
http://pythonbooks.revolunet.com/

In particular, say:
http://learnpythonthehardway.org/book/ // perhaps too intro for you? but check yourself...
http://www.diveintopython3.net/ // I think I'd go with this one

// Also take a look: http://www.stephendiehl.com/posts/postmodern.html

I think you're going to like PTVS: http://pytools.codeplex.com/
// For instance, check this out -- Mixed-Mode Python/C/C++ Debugging:
Quick overview:

Make sure to have the SciPy stack packages: http://www.scipy.org/stackspec.html
 
The point with python is that you don't just write C in python. There is a better way, a more pythonic way such that the code is readable and more efficient to maintain.

I started with https://developers.google.com/edu/python/ but then mostly picked it up from writing lots of code and looking at the cookbooks/ipython notebooks for numeric/scientific stuff: https://github.com/ipython/ipython/wiki/A-gallery-of-interesting-IPython-Notebooks. There's loads of other online resources e.g.:

http://learnpythonthehardway.org/book/
http://docs.python.org/2/tutorial/
http://www.diveintopython.net/toc/index.html

but I've tended to dip in and out of those rather than use them beginning to end. If you want to properly learn the python object (and how to avoid writing Java and C++ in python) those sites don't go far enough.
 
If you want to properly learn the python object (and how to avoid writing Java and C++ in python) those sites don't go far enough.

There are different programming styles in C++: OOP, GP, FP, modular. Which one are you referrring to?

a more pythonic way
Python is a language and not a programming paradigm. Do you mean a FP, signature-based approach?

All programmers use these programming paradigms; once you know which paradigm is best it then becomes predictable.

I suspect: FP style. Dynamic typing will be able to resolve many design bottlenecks.
 
Last edited:
There's another perspective: how difficult a language and how much design and application know-how do you need:

0. HTML
1. VB
2. Python
3. C#
4. C++

C++ is very unforgiving if the system is chaotically designed.
 
Last edited:
a more pythonic way
Python is a language and not a programming paradigm. Do you mean a FP, signature-based approach?

Here is The Zen of Python:

Code:
In [1]: import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

In [2]:

That's what Barny means by pythonic way. Look specifically at line 16.
 
If you want to properly learn the python object (and how to avoid writing Java and C++ in python) those sites don't go far enough.

There are different programming styles in C++: OOP, GP, FP, modular. Which one are you referrring to?

a more pythonic way
Python is a language and not a programming paradigm. Do you mean a FP, signature-based approach?

All programmers use these programming paradigms; once you know which paradigm is best it then becomes predictable.

I suspect: FP style. Dynamic typing will be able to resolve many design bottlenecks.


Sorry, I meant to say python object model in the previous post. Python is an OOPL. In python there are also different styles; python incorpoates a lot of FP. What I meant was, a Java programmer coming to python will try and write a load of getters and setters for their classes instead of properties, and not know about closures. Different problems will exist for the C++ programmer coming to python. One should not write C++ code for python, the same way one should not try to write C code using C++.
 
Here is The Zen of Python:

Code:
In [1]: import this
The Zen of Python, by Tim Peters
 
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
 
In [2]:

That's what Barny means by pythonic way. Look specifically at line 16.

OK, apple pie and stuff. It's nothing got to do with a language.
Since I'm probably Dutch at this stage the #17 will be a dawdle.

I don't believe #16 because s/w changes,unless of course you use Python for 1-off programs.


BTW Python was born in Amsterdam CWI.
 
I don't believe #16 because s/w changes

For a given problem there might be multiple solutions (e.g. look at Perl). However, there's usually only one obvious solution. Python strives for that.
 
Last edited:
For a given problem there might be multiple solutions (e.g. look at Perl). However, there's usually only one obvious solution. Python strives for that.

Clear.

Are there any experience reports on 2nd generation Python applications that need to be maintained?
 
http://www.python.org/about/quotes/

http://python.org/about/success/

https://programmers.stackexchange.com/questions/129859/how-is-python-used-in-the-real-world

https://stackoverflow.com/questions...ld-examples-of-applications-written-in-python

https://wiki.python.org/moin/Applications

Dropbox is written in python too. Oh yeh, and let me google that for you?

You know one thing I get slightly suspicious about is that I never hear bad things about python. I sometimes hear people talk about python being a bit slow for their needs to do x task, but I never hear people say "We built our entire product using python and now it's an unmaintainable mess that we have no control over", yet I've heard that several hundreds times w.r.t C, C++, Fortran et al. But then I write another sweet library in python in record time and get it.
 
Last edited:
Back
Top