Python's syntax is easy to learn, so both non-programmers and programmers can start programming right away. As of 2014, Python is the most popular choice among United States universities because it can be taught quickly and effectively.[1]
Readability
Python's syntax is very clear, so it is easy to understand program code. Python is often referred to as "executable pseudo-code" because its syntax mostly follows the conventions used by programmers to outline their ideas without the formal verbosity of code in most programming languages; in other words syntax of Python is almost identical to the simplified "pseudo-code" used by many programmers to prototype and describe their solution to other programmers. Thus Python can be used to prototype and test code which is later to be implemented in other programming languages.[2]
High-level Language
Python is a high-level language, meaning that many parts of a program, like memory management and reading/writing files, are handled automatically under the hood. This gives you the ability to program at a faster rate than a low-level language will allow you.
Object-oriented
Object-oriented programming allows you to create data structures that can be re-used, which reduces the amount of repetitive work that you'll need to do. Most modern programming languages are object-oriented or have support for object-oriented programming features. Additionally, object-oriented techniques are used ubiquitously in the development of medium-to-large software projects, and a valuable skill in the industry. Python's support for object-oriented programming is one of its greatest benefits to new programmers because they will be encountering the same concepts and terminology in their work environment. If you ever decide to switch languages, or use any other for that fact, there's a good chance that you'll be working with object-oriented programming.[3]
Completely Free
Python is both free and open-source. The Python Software Foundation distributes pre-made binaries called CPython that are freely available for use on all major operating systems. You can also get CPython's source-code, to modify and distribute as allowed by CPython's license.[4] (Luckily, CPython has a permissive free software license attitude.)
Cross-platform
Python runs on all major operating systems like Windows, Linux, and macOS. You can send any Python file you created to a friend, and they will generally be able to run it regardless of their setup. (There's a few nuances and exceptions to this that will be covered later in the course.)
Widely Supported
Python has an active support community with many web sites, mailing lists, and USENET "netnews" groups that attract a large number of knowledgeable and helpful contributors.
It's Safe
Python disallows certain "unsafe" programming practices that can lead to crashes and undefined behavior. Python doesn't have pointers like other C-based languages, and manages its internal memory automatically. This makes it a much more reliable language, and eliminates the risk of receiving vague, hard-to-diagnose issues such as segfaults, or incorrectly reading garbage data from memory. Along with that, errors never pass silently unless they're explicitly silenced. This allows you to see and read why the program crashed and where to correct your error.
Batteries Included
Python is famous for being the "batteries are included" language.[5] There are over 300 standard library modules which contain modules and classes for a wide variety of programming tasks.[6] For example, the standard library contains modules for safely creating temporary files, mapping files into memory, spawning and controlling sub-processes, compressing, decompressing, and parsing files, interfacing to various graphical user interfaces, sending e-mail, fetching and parsing web pages, and much more. It's possible, for example, to create a custom web server in Python using only a few dozen lines of code, just using the modules included in Python.
Extensible
In addition to the standard libraries, there are extensive collections of freely available add-on modules, libraries, frameworks, and tool-kits, which generally conform to similar standards and conventions. Modules can be easily installed onto your computer using the offical PyPI system, and used in your programs exactly the same way as you would use the built-in libraries. As of 2022, there are over 380,000 third-party modules available for use.[7] Some popular modules will be covered in this course.
Multiple industry leaders have praised Python as a language they use on a regular basis:
"Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we're looking for more people with skills in this language." -- Peter Norvig, director of search quality at Google, Inc.[8]
"Python is fast enough for our site and allows us to produce maintainable features in record times, with a minimum of developers," -- Cuong Do, Software Architect, YouTube.com[8]
"Python plays a key role in our production pipeline. Without it a project the size of Star Wars: Episode II would have been very difficult to pull off. From crowd rendering to batch processing to compositing, Python binds all things together," -- Tommy Burnette, Senior Technical Director, Industrial Light & Magic[8]
"Journyx technology, from the source code of our software to the code that maintains our Web site and ASP sites, is entirely based on Python. It increases our speed of development and keeps us several steps ahead of competitors while remaining easy to read and use. It's as high level of a language as you can have without running into functionality problems. I estimate that Python makes our coders 10 times more productive than Java programmers, and 100 times more than C programmers." -- Curt Finch, CEO, Journyx[8]
"Python, like many good technologies, soon spreads virally throughout your development team and finds its way into all sorts of applications and tools. In other words, Python begins to feel like a big hammer and coding tasks look like nails." -- Mustafa Thamer of Firaxis Games, talking about Civilization IV.[8]
Critically think to yourself about readability. Is one huge paragraph easier to read than three small paragraphs? What reasoning lead you to choosing the answer you picked? How does this apply to reading and writing code in programs? How might readable code help multiple people work on the same project quickly?
Critically think to yourself about computer speed. When would speed be important? When would speed be unimportant?
Checkpoint: Before moving on to the next lesson, you should ponder about why you are learning Python, and what you hope to accomplish through this course.
Completion status: Ready for testing by learners and teachers. Please begin!