via Huffpost : Why do people use Python instead of C/C++ or Assembly? originally appeared on Quora: the place to gain and share knowledge, empowering people to learn from others and better understand the world.
Answer by Stan Hanks, CTO of Columbia Ventures Corp, on Quora:
Teaching people to program should ideally have very little to do with teaching them the specifics of a language; the language that you use is typically selected for its utility in fitting in with the upper-level courses that are offered in the same environment.
What’s key – and one of the reasons that Python is so frequently used – is that the language allows you to rather effortlessly teach people how to think algorithmically, and then how to render that into code that can be used to both further their understanding and demonstrate it in terms of results.
Python is really simple, it’s designed expressly to promote readability of code, and allow simple expression of concepts in very few lines. With automatic memory management and the ability to function in both imperative and object-oriented paradigms equally, it’s a great place to start teaching, and can be scaled up rapidly to more complex programs in later coursework.
And yeah, for a well rounded education, you do need to get down in the internal bit fields of the CPU, learn about what exactly is happening in terms of the actual digital logic that makes the CPU work, how addition and multiplication works in hex and then how to make that happen in hardware, how memory management works, all that jazz.
But that’s not the real learning – the real learning is in thinking about how a given problem can be represented in a repeatable set of instructions – an algorithm – and how to reason about algorithms and data structures in a way that’s rigorous and complete. Everything else, that’s optimization.
For Python versus other languages, the place where it really gets interesting is that the unit time per solution is lower than it is with languages like Java, C++ or C.
Yeah, it’s interpreted (ish). Yeah, it’s less efficient at execution, sometimes by a lot. But it’s really fast to write and relatively easy to use to build projects at scale.
Back in the day, the code that I wrote was the tightest of the tight, focused on doing more in a single CPU clock cycle than other people thought was possible. I lived for being able to squeeze performance out that others believed couldn’t be done. I did that in assembler, and C, and frequently had C urp up assembler so I could see what it was doing with my code which I would then revise until the output aligned with the instructions I knew would minimize cache misses and maximize pipeline performance.
On 20MHz processors, with a couple of megabytes of memory, when you’re dealing with real-world sized data, that sort of fanaticism matters. Today? I’ve got multi-core 64-bit processors with more L2 cache than entire networks of systems had then.
So if my code is a little slower, I can run it on faster hardware, or I can break it up to run on more processors in parallel.
But unlike those days when I would spend a couple of months on a solution that ran some real-time data acquisition code (fun fact: code that I wrote for a PET camera ran from 1986 to 2005, unchanged, precisely because there literally was zero room for improvement) these days I’m looking at my much more expensive developers and thinking about how many features per unit time are getting shipped.
I’d much rather have them writing code rapidly that can then be modified rapidly when it’s not exactly what the users expected, than have super-tight polished optically flat code written in C that’s probably pretty brittle if someone else sticks their fingers in it.
This question originally appeared on Quora – the place to gain and share knowledge, empowering people to learn from others and better understand the world. You can follow Quora on Twitter, Facebook, and Google+. More questions:
- Programming Languages: What are some books about assembly language that should be easy to understand?
- Computer Programming: Should we trust AWS?
- Computer Science: Why should I care about distributed computing?
Source : Huffpost | Why Python Is the Best Programming Language With Which to Learn