Python 3 - Overview

Last Updated: 2022-04-04

Why Python

  • Easy to learn.
  • Available everywhere: Linux, macOS, Windows.
  • Super popular in machine learning / data science, competing with R.
  • help() gets docstring for any module / method / function.
  • Simple, compact and powerful.
    • list comprehensions.
    • class magic methods.
    • very powerful OOP.
    • built-in strings and array slicing.
    • huge and coherent standard library.

globals() vs locals() vs vars()

  • globals(): returns the dictionary of the module namespace
  • locals(): returns a dictionary of the current namespace
  • vars(): returns either a dictionary of the current namespace (if called with no argument) or the dictionary of the argument.