Register to get access to free programming courses with interactive exercises

Read more about Python Python: Setting up the environment

To delve deeper into setting up the Python environment, we need to remember the theoretical basics of the language. It will help you understand more about the environment and how to work with it.

Programming languages

What is a programming language? There are two related yet independent themes when it comes to this concept.

On the one hand, a programming language refers to the syntactic and semantic rules by which source code is written and works. Unlike natural languages, these rules are strict. Any tiny error can cause the code either not to run or not to work correctly.

For example, you can't write my name = 5 with a space in the variable name in Python. These rules exist in books and the heads of programmers and language developers. The entire set of rules exists as a specification — a separate document.

On the other hand, a programming language is a program that runs and compiles our code. It's usually called the execution environment.

The runtime environment is the kind of specification incarnate. It's sometimes called implementation. A particular language may have several implementations, including a reference implementation, which all others look up to. Different people and companies can develop different implementations.

Python has no dedicated specification, but there is a reference implementation. It's called CPython, a Python interpreter implemented in C. If you people talk about Python, they probably mean the CPython reference implementation. Other options usually have their names. For example, the language implementation for running programs on the .NET platform is called IronPython.

Python

Python is an interpreted programming language with dynamic, strong typing.

Let's see what these words mean.

Interpreted programming language

Some programming languages have a stage involving compilation into machine code, for example, the languages C, Rust, and Go. These are compiled languages.

Python works differently. The interpreter executes the program step by step rather than running directly on the computer's CPU. It is why you always need an interpreter to run a Python program. Only it can execute Python programs.

Strictly speaking, Python also has a compilation phase but outwardly behaves exactly like an interpreted programming language:

  • You start the program
  • The interpreter opens program files and loads the source code from them
  • The interpreter then converts the source code into bytecode, checks for syntax errors, and starts executing in steps

Dynamic typing

In some languages, the interpreter checks types and the availability of functions and variables at runtime. These languages are called languages with dynamic typing. The error will pop up if we accidentally make a mistake and call a non-existent function.

In statically typed languages, these errors are visible before we run the code. The word "static" means that the program isn't running.

Usually, compilers perform static checks, but there are also special tools — static code analyzers. These parsers also exist for languages with dynamic typing, but they track fewer errors.

Strong typing

Python is a strongly typed language. It means that it tries not to set types automatically. It doesn't convert values from one type to another.

In other words, Python won't let you add a number to a string. If we try to do something like that, we get an error. Python requires that any conversion be explicit. The programmer must explicitly use the appropriate conversion functions in each case.


Recommended materials

  1. What is a compilation
  2. What is interpretation

Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

About Hexlet learning process

For full access to the course you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.bookmate">Bookmate</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.healthsamurai">Healthsamurai</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.dualboot">Dualboot</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.abbyy">Abbyy</span>
Suggested learning programs
profession
new
Developing web applications with Django
10 months
from scratch
under development
Start at any time

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.