=============== ¿Qué es Python? =============== ¿Python? ======== .. figure:: /_static/Spider_Morph_Ball_Python.png :class: fill CC BY-SA 3.0 http://commons.wikimedia.org/wiki/File:Spider_Morph_Ball_Python.png#mediaviewer/File:Spider_Morph_Ball_Python.png Python! ======= .. figure:: /_static/holy_grail.jpg :class: fill © 1975. Sony Pictures Home Entertainment. Lenguajes --------- .. figure:: /_static/tiobe-long-term.png Fuente: `TIOBE `_ Very Long Term History .. nextslide:: .. figure:: /_static/tiobe.png Fuente: `TIOBE `_ Very Long Term History A dónde vamos ------------- .. figure:: /_static/pymap.png :class: fill Copyright https://hairysun.com/subway-map-to-python.html Versiones ========= Python 2 o 3 ------------ - Python 2.x es *legacy* - Python 3.x es presente y futuro del lenguaje. Comentaremos algunas diferencias. .. nextslide:: .. figure:: /_static/python-release-cycle.png :class: fill Fuente https://python-release-cycle.glitch.me .. nextslide:: ¿Qué versión? ------------- - Versión oficial Python Software Foundation - Soporte: 5 años Versión recomendada (octubre 2022): **CPython 3.13, EOL 2029-10** Fuente: https://devguide.python.org/#status-of-python-branches Otros intérpretes ----------------- Hay otras alternativas - CPython - PyPy - MicroPython - PyScript Entorno ======= Instalar intérprete Python -------------------------- - Linux: - Paquete sistema ``(apt | yum | dnf) install python3`` - pyenv (https://github.com/pyenv/pyenv#basic-github-checkout) - Windows: - Oficial (https://www.python.org/downloads/windows/) - https://www.microsoft.com/es-es/p/python-38/9mssztt1n39l - macOS: - Oficial (https://www.python.org/downloads/mac-osx/) - homebrew + pyenv (https://github.com/pyenv/pyenv#homebrew-on-macos) .. note:: Usar https://realpython.com/intro-to-pyenv/ Acceso a la documentación básica -------------------------------- - https://docs.python.org/3/library/ Documentación oficial. - https://devdocs.io/ Documentación de Python y otros lenguajes. Permite navegación offline y desde el móvil. .. note:: - Escoger la versión adecuada. La última es una buena opción pues suele comentar los cambio con respecto a versiones anteriores. - La documentación se puede descargar. Una herramienta interesante es Zeal. Ver https://zealdocs.org/. - Similar a Zeal pero online es https://devdocs.io/. Intérprete interactivo ---------------------- .. doctest:: >>> import sys >>> sys.version # doctest: +SKIP '3.13.2 (main, Feb 4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]' Escritura de scripts -------------------- .. code:: bash #! /usr/bin/env python3 print('Hola mundo!') * POSIX: ``chmod +x`` * Windows: extensión .py Editores y entornos de desarrollo --------------------------------- * Sencillos: Sublime Text, Notebook++ * IDE completo: VS Code, PyCharm * Científicos: Jupyter Notebook, Spyder * Para principiantes: Thonny .. note:: Se puede contrastar la popularidad en la encuesta anual https://survey.stackoverflow.co/2024/technology/#2-integrated-development-environment