Python has become the choice of programming language for many people who start to learn coding. It has very intuitive syntax and flexibility of supporting dynamic typing. In addition, it’s an interpreted language, which makes it possible to use an interactive console for learning purposes. Basically, you can just use a command-line tool, such as Terminal in Mac, to start Python learning, because macOS is nowadays shipped with Python.
When you learn Python, you’re gradually getting familiar with its data structures, control flows, classes, functions, and other basic stuff. One thing that I’ve found to be interesting is various acronyms in Python, which we encounter from time to time. This article is to review ten such acronyms. Some of them are general programming principles, while some others are more specific to Python coding. Nevertheless, each of them has its own useful and/or intriguing aspects.
The first acronym that we should know is OOP — Object-Oriented Programming, and this is what Python is designed based on. We know that programming itself is about coding, but programs themselves should be about data. Our programs need to take input data, process data, and output data. Please be noted that data that are discussed here are in the most general sense, which can include tabular data, strings, user actions (e.g., button clicking), images, and any form of data that has information. Our code’s job is to handle these various forms of data and present them in the desired way.
To accomplish our job, we need to our code that is capable of processing these data, and one common design pattern in modern programming languages, including Python is to take the OOP paradigm. The idea is very intuitive — we wrap our data with particular objects. More specifically, the objects can hold data (e.g., attributes) and can operate data (e.g., methods). For instance, if we build a car racing game. We can build car objects, and each of them can have particular attributes, such as color, max speed, and weight. In addition, these objects can have operations, such as brake and accelerate. The logical organization of these data is centered at the object — the car.
Let’s look at a specific example in Python. We can wrap the string data using the built-in str class, which will not only allow us to pass string data using a string object, but allow us to change the way how the string is represented. Let’s see a very trivial example below.
#python #data-science #artificial-intelligence