I\'m a beginner in programming. I am learning Python as a hobby. However, after
ID: 654315 • Letter: I
Question
I'm a beginner in programming. I am learning Python as a hobby. However, after reading some things in what concerns, for example, its speed, I asked again myself if I should really learn Python or learn other more difficult language.
I am in sciences at school, and have interest in physics and microcontrollers, so a performance-wise language would be needed for, for example, computational calculations, and that. So probably a language like C or C++ would be more handy in terms of future university degree.
So, my questions are:
I saw that Python is an interpreted language, therefore slower (up to 100 times from C++, from what I read at Stack Overflow, which is a lot). Can't it be compiled so that no interpreter is needed and it has high speed? (like C is) I mean, it's what the interpreter does, isn't it?
Does Python have any chance of being useful for science? How could it surpass it's speed lack?
Isn't there the possibility of writing a program in Python, and translate it to C++ in order to compile? Therefore having the simple writing of Python and the speed of C++? Are there any Python-to-C++ translators?
Explanation / Answer
This may be a bit too broad but I'll bite
Yes python can be used for science application (see numpy and scipy) , it will depend on the exact application as to whether it is suitable (but this is true for any language).
wrt speed i'd note that
the cpu is not necessarily the bottleneck even in scientific applications e.g. I/O is much slower
the skills you learn programming with python will be largely transferable to other languages, you can always learn C++ later (and in fact it is beneficial to learn several languages)
there is no rule stating you have to use a single language for the entire application, its perfectly possible to do some fast critical section in C then build the rest in python
translating to C or C++ is possible but doesn't necessarily get you that much speed increase unless you do it by hand (and do it well).
honestly I think you should get stuck in with python
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.