Skip to the content ForoHackers
Log inJoin

Python: start here

Python
#553 · Ophuscado · · Report

Python is a dynamically typed, readable, general-purpose language with a huge ecosystem. It is the usual choice for scripting, automation, data science, machine learning, teaching and glue between systems. It trades raw speed for fast development, and leans on libraries written in C or other languages when speed matters.

Key concepts

  • Everything is an object: names refer to objects; assignment binds names rather than copying values.
  • Data structures built in: lists, dictionaries, sets and tuples cover most needs.
  • Iteration protocols: for loops, comprehensions, iterators and generators.
  • Functions and classes: first-class functions, decorators, and a simple object model with duck typing.
  • Modules and packages: the import system, virtual environments and the package index.
  • Exceptions and context managers: error handling and the with statement for cleanup.

Vocabulary

  • Pythonic: written in the idiomatic style of the language.
  • Virtual environment: an isolated set of installed packages for one project.
  • Type hints: optional annotations that external checkers and editors use.
  • GIL: the global interpreter lock in the reference implementation, which limits threads running Python code in parallel.

What to study, in order

  1. Basic syntax, strings, lists and dictionaries, typing into the interactive prompt.
  2. Functions, files, exceptions and modules; write small scripts that do real chores.
  3. Classes, iterators, generators and decorators.
  4. Virtual environments, installing packages and writing tests.
  5. A project in your area: a web service, a data analysis or an automation.
  6. Read the standard library's documentation for modules you reinvent, and learn when to use processes, threads or async.

Related tags

#interpreters #data-science #machine-learning #shell

Log in or join to reply.