The Code
[code]
#!/usr/bin/python
# Hello World
print(‘Hello, World!’)
[/code]
How It Works
Python is a high-level interpretted language. High-level means its very abstract, and “simple” in that its “instructions” are not closely tied to low-level machine code. An interpretted language means it requires an interpreter — another program that understands “python” code and actually runs it.
In this example, we have a file that starts with a shebang line, which is a UNIX convention that tells the operating system which interpreter to use to run the following code. In this case, we are using the python interpreter. Next, we have a generic comment line. Lastly, we have one simple line of code to print some text to the screen. No fancy syntax like semi-colons or variables; no memory allocations or registers; no complex computer instructions. Just run it.
Why Use Python
Python is an extremely popular language. It is easy to write and read, but yet has a lot of features to so that many programming paradigms can be used. For example, python programs can be a combination of procedural, functional, imperative, and object-oriented. Because of it’s popularity, it also has a very large library of supporting functions to help make it more useful, more easily — like create user interfaces, connect to databases, do scientific computing, or help automated system administration. The Python Package Index contains over 100,000 packages to help make python easier to get a programming job done.
Limitations
Python is a really great language but it does have downsides. Python can be relatively slow by the nature of it being interpretted, and high-level. It also has a “Global Interpreter Lock” (GIL) that limits a python program from running on multiple CPUs at the same time. It is also very easy to be “wasteful” or “lazy” with python because of the nature of high-level programming languages. There’s not as many “rules” to follow when programming, and there’s less computer resources to “manage” while programming, and both can lead to inefficient programs. This is not necessarily the language’s fault, but it is something to be aware of.