- General information
- High-level scripting language
- Dynamic and strong typing
- Implemented in C (as is NumPy/SciPy)
- Extremely widespread: Google (YouTube, Google Brain, DeepMind), Dropbox, Microsoft, Intel are the largest supporters
- Clear, simple syntax
- Mostly object-oriented, but has a lot of functional influence
- Named after Monty Python, not the animal!
- First released in 1991
- Often compared with Ruby or Perl; in contrast to Ruby...
- Works on different platforms: Windows, Linux, mac OS, x86, ARM, microcontrollers, ...
- Applications
- Literally everything and everywhere
- Tooling:
python
(useful: the-i
flag)ipython
(useful:who
andwhos
,?
)- Jupyter Notebook
- PyCharm (also Community Edition)
- Spyder
pip
andconda
- Python 3 vs Python 2:
- UTF-8 as default source file encoding
- Syntax:
print
function - Semantics: Laziness, integer division
- Unicode strings by default + separate
bytes
andbytearray
classes python
vspython3
on Linux
- Libraries:
- NumPy
- SciPy
- SymPy
- matplotlib
- python-control
- scikit-learn, scikit-image, astropy, ...
- Keras, TensorFlow, Theano
- Numba
- Finding information:
- Be careful about the docs version (e.g. use the latest NumPy/SciPy docs, Python 3.6 etc.)
- Use Zeal or Dash
- Use StackOverflow (just google in English)
- There always is a solution for your problem!
- Read docstrings / use
help()
or?
- NumPy/SciPy: If in doubt, read the source
- Best practices:
- Zen of Python (PEP 20)
- PEP 8
- Hard tabs vs spaces: Use 4 spaces, full stop
- Flat source code: Use list/set/dict comprehensions and generators
- Python basics
- Syntax:
- definition of variables and functions, default, named and positional args
- import statements
- indexing and slicing
- branches
- loops
- IO (
print
) - strings and string interpolation
- Operators and statements:
not
@
**
_
when unpackingNone
as a nil valuepass
- Data structures:
- tuples, tuples unpacking
- lists
- dicts
- sets
ndarray
s
- Misc:
- list comprehensions
- iteration,
enumerate
,zip
- functions are first-order citizens
- laziness: e.g.
map
,list
- Naming conventions
snake_case
andSCREAMING_SNAKE_CASE
- Underscores magic
_
- Special symbols:
__version__
__init__()
__name__
- Classes and objects: a completely different story
- Pitfalls:
- mutable objects as default args
- closures capture references (late binding)
- Syntax:
Created
April 5, 2017 11:57
-
-
Save mp4096/04145475ae2b32cc795f08c268d61824 to your computer and use it in GitHub Desktop.
An extemely short introduction to Python
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment