Python is a popular programming language used for web and software development.
If you’re just getting started programming computers and other devices, chances are you’ve been trying to figure out which programming language is the best to learn first. There are many articles on the internet about what programming language you should be learning — which are the best for what platform, which are easiest to learn, which are the most likely to help you land a job making the big money. If you’ve been sifting through all those opinions, chances are good you’ve heard of Python.
There probably isn’t a single right answer to your question. Learning any programming language will also teach you how to think like a programmer. All programming languages have their strengths and weaknesses. If you’re looking for a language that works in a broad range of applications, or just want to dip your toe into the coding waters, Python may be good to try.
Python has a reputation for being easy to understand for new programmers. It can be used to write programs for computers or applications for the web. If you want to create the next big mobile app, however, Python is not a popular choice. A 2019 survey of Python users found that the most popular uses were for web development and data analysis. Only about 6 percent of respondents used it for game development or app development.
There are many commercial applications for Python programming, but the language has also caught hold in academic circles, especially among those working with large amounts of data. It’s also useful for hobbyists.
Python is the creation of Guido van Rossum, who had been working with a language named ABC at his then-employer, the Centrum Wiskunde & Informatica (CWI) — the national mathematics and computer science research institute in the Netherlands. While he liked some aspects of ABC, he was frustrated by how hard it was to extend the language.
During his Christmas holiday break in 1989, van Rossum decided to try creating his own language. A little over a year later, in February 1991, he uploaded the first version of his creation to USENET. He’d also been reading scripts for episodes of “Monty Python’s Flying Circus,” from the famous British comedy troupe. Looking for a name that was “short, unique and slightly mysterious,” he chose to call it Python. Do you have to be a fan of the show if you want to code Python? In the words of the Python Software Foundation, “No, but it helps. :)”.
Although he considers himself retired now, van Rossum holds the title of Python’s “benevolent dictator for life,” a title he’s held since 1995. In fact, since then a number of open-source creators — who get the final say on changes to their projects — have also been given that title by their development communities.
Python is open source, which means it’s free to use and distribute, according to the official definition created by the Open Source Initiative. You can also download a copy of the source code if you like.
As of May 2020, the PopularitY of Programming Index (PYPL), which ranks programming languages by how often people search for tutorials about them, lists Python in first place. The site, which is intended to help budding coders choose a programming language to start with, changes often, but interest in Python has grown the most between 2015 and 2020.
Robert Thorstad, data science fellow at Insight Data Science, believes that ease of use is one of the main reasons for Python’s rise. “Ease of use is an explicit design philosophy in the Python language,” he says. The time-honored practice of writing a short program that prints, “Hello, world” on the computer screen might take a Java coder many lines, but in Python, it can be done by just typing:
print (“Hello, World!”)
That simplicity, Thorstad said, makes Python seem friendlier to novice programmers. Many have praised Python code as being easy for humans to read. Where other programming languages use characters such as semicolons to show the end of a command, Python uses a new line. Rather than using the curly brackets that might enclose a function in other languages, Python uses indentation.
Uses for Python Programming
Python is a versatile language, and its developers often use it for both business and personal reasons. According to a 2018 study by the nonprofit Python Software Foundation and JetBrains, a for-profit company that makes tools for software developers, people are using the language to create applications for web, writing games and mobile applications, system administration, education, machine learning and data analysis.
Python is one of many object-oriented programming languages. Objects are sections of typed code that capture the state of certain data. Those objects can be used later by other code without having to write it all out again. The information encoded in the object affects the code that calls it, making the object a versatile programming tool.
Another Python advantage is that applications written with the language work on many platforms, including Windows, Macintosh and Linux computers. Python is an interpreted language, not a compiled language. That means that unlike applications written in languages such as C, COBOL or Assembler, code written in Python has to run through a process of interpretation by the computer. It’s easier for humans to write and read but forcing the computer to interpret the code every time slows it down. Speed is often cited as a downside to Python.
Thorstad, however, believes the language gets a bad rap. “Python has a number of libraries that are rapidly closing this gap.” He points to libraries like NumPy and TensorFlow, and compilers like Numba and Cython, all of which are open-source tools that add functionality to the programming language and enhance its speed.
Python for Data Science
Although Python can be used for many different types of applications across many industries, the language has become especially popular for data scientists. The Python community, Thorstad points out, is very large and very active. “There is a large number of strong and really useful libraries for doing common data-science tasks in Python,” he says. Among the tools developed by the community include:
- Machine-learning tools (TensorFlow, PyTorch, Theano, Gensim)
- Numerical libraries (NumPy)
- Statistical libraries (statsmodels, SciPy)
- Plotting libraries (Matplotlib, Seaborn)
In the second edition of his book “Python for Data Analysis,” Wes McKinney, the director of Ursa Labs and the creator of the Pandas framework, agrees with Thorstad that community-created libraries and frameworks help Python compete with other data-science alternatives such as R, MATLAB and others.
“Combined with Python’s overall strength for general-purpose software engineering, it is an excellent option as a primary language for building data applications,” he writes.
The worldwide Python community has many conferences each year at which programmers of all kinds and skill levels can get together for learning and networking. Among these is PyCon, which takes place several times a year at multiple locations worldwide. The Python Software Foundation maintains a list of events on its site.
With a strong community working together to help one another and build tools that enhance Python’s ability to handle large amounts of data, people interested in data science programming can consider Python a safe bet. It looks like Guido van Rossum’s plan for an extensible programming language works well — and then some.
Getting Started With Python
If what you’ve learned about Python interests you and you’re ready to jump in and start programming, there are many resources available to help. “The best way to learn any programming language is by doing,” Thorstad says. “I would advise folks to choose a project they are passionate about and start building it.”
If you don’t already have Python pre-installed on your computer, you can download it from the Python site for free. Thorstad recommends the free Anaconda distribution, which includes many popular programming libraries, or the Spyder integrated development environment, which features a graphical interface. If you don’t want to (or can’t) install the software on the computer, Thorstad also recommends a free tool, Google Colaboratory, which allows you to write and run Python code in your web browser.
Ultimately, the only software you really need to write Python code is a text editor, and the chances are very good that you have at least one installed on your computer.
Your local library and bookstore probably have programming guides that can help you get started with Python. Schools and universities offer classes in the language. There are also paid online courses you can take, but you don’t have to spend a fortune to learn. There are good, free options for beginners available online as well:
- Python for Beginners, from the Python Software Foundation
- Google’s Python Class
- Introduction to Computer Science and Programming in Python — Massachusetts Institute of Technology (MIT)
- Introduction to Python — Microsoft
- Python for Everybody Specialization — University of Michigan (via Coursera)
- Python Tutorial — w3schools
Of course you should pick the programming language that suits your project best, but if you’re interested in easy-to-read code that can be used for all kinds of personal and corporate projects, learning Python is a great place to start.
If you’ve ever taken a programming class or looked at the first exercises in a programming book, you may have noticed that printing “Hello, World!” is a common first task for new programmers. For that, you can thank Brian Kernighan, who included it in a manual he was writing for the programming language B back in 1972. Kernighan was inspired by an illustration he’d seen of a chick saying the phrase as it hatched from an egg. His work inspired many others to do the same and now the exercise is part of programming lore. (Source: howstuffworks)