Most Frequent Python Terms

Manjula Mishra
6 min readDec 26, 2019

--

Learning the most basic Pythonic terms will come in handy. I remember when I started coding in Python, I had to Google those terms almost all the time. I thought it would be a good idea to document them for my own clarity and also for others who are just starting their journey. Hope you enjoy it!

Like any language that we speak, Python has meaning to its terms. Image downloaded from unsplash.

How does Python work?

Created by Guido van Rossum, Python has two parts to it:

  1. Python as a language.
  2. Python as an implementation.

Python as a Language:

Python as a language has rules and grammar to write code. Much as in any spoken language, Python defines its own rules around what is an acceptable format of writing code. That format is called syntax. If the syntax is not correct, the system throws a syntax error, think if it as a grammatically incorrect sentence in English.

Python as an Implementation:

Python as an implementation is a computer program that understands those rules and then executes the code.

Prompt:

Three ‘greater than’ >>> signs together are called a prompt. When you see >>>, that means your computer is ready for your Python use. An example:

>>> 2 + 2

4

Expression:

An expression is a piece of code that produces a value. More specifically, if it can be assigned to a variable, or if it can be printed, it’s an expression. For example, these are all expressions:

Statements:

An assignment statement is to assign something to a variable, e.g.:

x = 15

An expression statement is something like:

x = (15 + 20)

A simple statement in Python is a single logical line. Some of the Python simple statement examples are break, continue, return and import.

Compound statement consists of a group of other statements and usually spread into multiple logical lines. The compound statements are executed when a condition(s) satisfies. Examples are if/else, while, for loops, exception handling etc.

Boolean Expressions: (True/False):

True/False are English equivalent of Yes/No. A Boolean expression is a logical expression which evaluates to one of two states: either True or False.

Syntax Error:

Syntax errors are the most common kind of errors in Python. They are equivalent to a grammatical error in English.

Comments:

A comment in Python starts with symbol #. A comment can be written in one long line till the end of it. It can also be written in multiple lines with each line starting with #. A comment can also be written next to a statement.

Docstrings:

In Python, docstrings are a convenient way of documenting your comments, associated details or explanation related to a function, class, modules, methods etc. You can also use it as a multi-sentence comment. Some of the examples:

The orange inked portion is called a docstring.

Another example from:

IDLE/IDE:

IDLE is integrated development environment (IDE). It’s basically for editing and running Python programs interactively. The IDLE graphical user interface (GUI) is automatically installed with the Python interpreter. IDLE was designed specifically for use with Python. It’s a very widely used tool for Python coding. It comes with editor as well as debugging features. ^1

This website lists following as the best Python IDEs and Editors. I personally use Juypter Notebook/Google Colab for IDEs and VSCode/Sublime Text Editors.

Top Python IDEs :

  • PyCharm.
  • Spyder.
  • Pydev.
  • Idle.
  • Wing.
  • Eric Python.
  • Rodeo.
  • Thonny.

Best Python Code Editors:

  • Sublime Text.
  • Atom.
  • Vim.
  • Visual Studio Code (VSCode).

Whitespace:

As defined by computerhope.com:

“Alternatively referred to as spacing or whitespace, white space is any section of a document that is unused or space around an object. White spaces help separate paragraphs of text, graphics, and other portions of a document, and helps a document look less crowded.”

Indentation:

From w3school.com

“Indentation in Python refers to the (spaces and tabs) that are used at the beginning of a statement. The statements with the same indentation belong to the same group called a suite.” Example:

Functions:

As taken from Geeksforgeeks:

“A function is a set of statements that take inputs, do some specific computation and produces output. The idea is to put some commonly or repeatedly done task together and make a function, so that instead of writing the same code again and again for different inputs, we can call the function.
Python provides built-in functions like print(), etc. but we can also create your own functions. These functions are called user-defined functions.”

Built-in functions:

Built-in functions in Python are the functions which are always available for you to use such as print(), help(), min(), max() etc.

Calling a function:

Calling a function means executing a function. For example:

Linting:

Linting means analyzing code for potential errors such as syntax errors, other structural errors. Example: print “Hello World”. If you’re using VSCode, it will show as a red underline and also shows the suggestions:

Debugging:

When you run your code (specially complex, multiline codes), there are great chances that you program might run into errors. Finding those errors and fixing them is called is debugging.

Unit Tests:

A unit test tests if your code is behaving expectedly. It can expose edge cases. Unit tests forces you to think harder about the problem you’re solving and makes you write better codes. More from Geeksforgeeks:

Unit Testing is the first level of software testing where the smallest testable parts of a software are tested. This is used to validate that each unit of the software performs as designed. The unittest test framework is python’s xUnit style framework. Method: White Box Testing method is used for Unit testing.”

Code Snippets:

This website explains it well:

“Code snippets are small blocks of reusable code that can be inserted in a code file using a right-click menu (context menu) command or a combination of hotkeys. They typically contain commonly used code blocks such as try-finally or if-else blocks, but they can be used to insert entire classes or methods.”

An example:

https://www.pythonforbeginners.com/code-snippets-source-code/date-and-time-script/

Variables:

A variable is a way to store values in the computer memory. A variable then gives its stored data to the computer for processing. A variable cannot start with a number, it can only start with either a character or underscores. In Python, variable names are case sensitive that means my_var is not same as My_Var.

PEPs- Python Enhancement Proposals:

These proposal provide documentations and description the way Python language evolves. PEPs are also considered a reference point for acceptable code style and standards in Python.

PEP 8:

PEP 8 is Python’s style guide for writing code. It provides consistency, styling, formatting and standard for your code quality. For example, indentation (tabs vs four spaces), spacing etc.

--

--