Saltar al contenido ForoHackers

Python: start here

Python
#3059 · · Citar · Denunciar

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

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder