====== About ====== The main goal of this documentation is to make available notes I'm taking about the Python language. It does not pretend to be a thourough tutorial on Python. Very good tutorials and books already exist indeed (see for instance the `official Python website `_ or `dive into python `_ and take a look at the bibliography section :ref:`biblio`). These notes may be useful for beginners or more experienced Python developers, which is the main reason for making it public. Some sections are ready for reading (:ref:`main_beginners`, :ref:`main_advanced`) and some others maybe draft or empty (:ref:`main_modules`, :ref:`main_libraries`) but will be filled in the future. Before starting, if you want to know why to use Python, just jump to the :ref:`advantage_vs_drawback`. You can also refer to this page with a tiny URL: http://tinyurl.com/d2k7bqe ========================== Before starting ========================== Python provides a shell, however, we strongly recommend to install `ipython `_ instead, which provides nice features such as tab completion. In order to start an interactive python shell, just call the **ipython** executable. In interactive mode, the prompt is repesented by the >>> signs. Most of the code snippets and examples provided here appear as follows:: >>> variable = 1 1 where python codes are preeceded by the >>> signs and outputs are shown without. For your convenience, the button in the top right corner removes the >>> signs (and the output) so as to permit a convenient copy/paste in your shell. Just a few comments about Python syntax before starting: * No ; character at the end of a line, just a return carriage * Indentation is important and used to separate code blocks * everything is an object And now for something completely different, see the next section for more information about Python syntax. .. _main_beginners: ========================= Essential Python syntax ========================= The following links present some basic notions about the Python language. Although Python is an Object Oriented language (everything is an object in Python), you do not need it to start programming in Python. We will have a very quick overview in this section. .. toctree:: :numbered: :maxdepth: 1 basics.rst variables numbers.rst data_structures.rst functions.rst print.rst module.rst files.rst builtins.rst .. _main_advanced: ================================================== Advanced topics on the Python language ================================================== Here are more advanced notions that will be needed to improve either the robustness of your code or to code performance. .. toctree:: :numbered: :maxdepth: 1 iterators.rst generators.rst exceptions.rst decorators.rst classes.rst namespace.rst packaging.rst sorting.rst boolean.rst tricky.rst .. _main_modules: ======================== Useful standard Modules ======================== There are more than 300 modules available in the `Python reference guite `_ covering many different aspects of computer science. Some of them are covered here below. .. toctree:: :numbered: :maxdepth: 1 modules.rst .. _main_libraries: ================== Great Libraries ================== Lots of code are already existing in Python. Most of the great packages are available in a common site called Pypi. Here are some packages I use quite often, which are great quality. =============== ================================ =============== ================================ matplotlib plotting a la Matlab numpy manipulating arrays efficiently scipy lots of numerical analysis tools networkx Playing with graph igraph Playing with graph =============== ================================ ========= Changelog ========= .. toctree:: changelog.rst todo.rst .. toctree:: :maxdepth: 2 biblio.rst .. toctree:: :hidden: :maxdepth: 2 why_python.rst biblio.rst .. toctree:: module_anydbm module_readline misc