Tutorial su Python
******************

Python è un linguaggio di programmazione potente e facile da imparare.
Dispone di strutture di dati efficienti e di alto livello e di un
approccio semplice ma efficace alla programmazione orientata agli
oggetti. La sintassi elegante e la tipizzazione dinamica di Python,
insieme alla sua natura interpretata, ne fanno un linguaggio ideale
per lo scripting e il rapido sviluppo di applicazioni in molte aree
per la maggior parte delle piattaforme.

The Python interpreter and the extensive standard library are freely
available in source or binary form for all major platforms from the
Python web site, https://www.python.org/, and may be freely
distributed. The same site also contains distributions of and pointers
to many free third party Python modules, programs and tools, and
additional documentation.

L'interprete Python è facilmente ampliabile con nuove funzioni e tipi
di dati implementati in C o C+++ (o altri linguaggi richiamabili da
C). Python è adatto anche come linguaggio di estensione per
applicazioni personalizzabili.

Questo tutorial introduce il lettore in modo informale ai concetti di
base e alle caratteristiche del linguaggio e del sistema Python. Aiuta
ad avere un interprete Python a portata di mano per un'esperienza
pratica, ma tutti gli esempi sono autonomi, così il tutorial può
essere letto anche off-line.

Per una descrizione degli oggetti e dei moduli standard, si veda The
Python Standard Library. The Python Language Reference fornisce una
definizione più formale del linguaggio.  Per scrivere le estensioni in
C o C+++, si legga Extending and Embedding the Python Interpreter e
Python/C API Reference Manual. Ci sono anche diversi libri che coprono
Python in profondità.

Questo tutorial non vuole essere completo e coprire ogni singola
caratteristica, come pure ogni caratteristica usata comunemente.
Invece, introduce molte delle caratteristiche più importanti di
Python, e vi darà una buona idea sullo stile del linguaggio. Dopo
averlo letto, sarete in grado di leggere e scrivere moduli e programmi
Python, e sarete pronti per saperne di più sui vari moduli della
libreria Python, i quali sono descritti in The Python Standard
Library.

Anche il Glossary vale la pena di essere sfogliato.

* 1. Stuzzichiamo il tuo appetito

* 2. Uso dell'interprete di Python

  * 2.1. Invocazione dell'interprete

    * 2.1.1. Passare Argomenti

    * 2.1.2. Modalità Interattiva

  * 2.2. L'interprete e il suo ambiente

    * 2.2.1. Codifica del codice sorgente

* 3. Un'introduzione informale a Python

  * 3.1. Usare Python come calcolatrice

    * 3.1.1. Numeri

    * 3.1.2. Stringa

    * 3.1.3. Liste

  * 3.2. Primi passi di programmazione

* 4. More Control Flow Tools

  * 4.1. "if" Statements

  * 4.2. "for" Statements

  * 4.3. The "range()" Function

  * 4.4. "break" and "continue" Statements, and "else" Clauses on
    Loops

  * 4.5. "pass" Statements

  * 4.6. "match" Statements

  * 4.7. Defining Functions

  * 4.8. More on Defining Functions

    * 4.8.1. Default Argument Values

    * 4.8.2. Keyword Arguments

    * 4.8.3. Special parameters

      * 4.8.3.1. Positional-or-Keyword Arguments

      * 4.8.3.2. Positional-Only Parameters

      * 4.8.3.3. Keyword-Only Arguments

      * 4.8.3.4. Function Examples

      * 4.8.3.5. Recap

    * 4.8.4. Arbitrary Argument Lists

    * 4.8.5. Unpacking Argument Lists

    * 4.8.6. Lambda Expressions

    * 4.8.7. Documentation Strings

    * 4.8.8. Function Annotations

  * 4.9. Intermezzo: Coding Style

* 5. Data Structures

  * 5.1. More on Lists

    * 5.1.1. Using Lists as Stacks

    * 5.1.2. Using Lists as Queues

    * 5.1.3. List Comprehensions

    * 5.1.4. Nested List Comprehensions

  * 5.2. The "del" statement

  * 5.3. Tuples and Sequences

  * 5.4. Sets

  * 5.5. Dictionaries

  * 5.6. Looping Techniques

  * 5.7. More on Conditions

  * 5.8. Comparing Sequences and Other Types

* 6. Modules

  * 6.1. More on Modules

    * 6.1.1. Executing modules as scripts

    * 6.1.2. The Module Search Path

    * 6.1.3. "Compiled" Python files

  * 6.2. Standard Modules

  * 6.3. The "dir()" Function

  * 6.4. Packages

    * 6.4.1. Importing * From a Package

    * 6.4.2. Intra-package References

    * 6.4.3. Packages in Multiple Directories

* 7. Input and Output

  * 7.1. Fancier Output Formatting

    * 7.1.1. Formatted String Literals

    * 7.1.2. The String format() Method

    * 7.1.3. Manual String Formatting

    * 7.1.4. Old string formatting

  * 7.2. Reading and Writing Files

    * 7.2.1. Methods of File Objects

    * 7.2.2. Saving structured data with "json"

* 8. Errors and Exceptions

  * 8.1. Syntax Errors

  * 8.2. Exceptions

  * 8.3. Handling Exceptions

  * 8.4. Raising Exceptions

  * 8.5. Exception Chaining

  * 8.6. User-defined Exceptions

  * 8.7. Defining Clean-up Actions

  * 8.8. Predefined Clean-up Actions

* 9. Classes

  * 9.1. A Word About Names and Objects

  * 9.2. Python Scopes and Namespaces

    * 9.2.1. Scopes and Namespaces Example

  * 9.3. A First Look at Classes

    * 9.3.1. Class Definition Syntax

    * 9.3.2. Class Objects

    * 9.3.3. Instance Objects

    * 9.3.4. Method Objects

    * 9.3.5. Class and Instance Variables

  * 9.4. Random Remarks

  * 9.5. Inheritance

    * 9.5.1. Multiple Inheritance

  * 9.6. Private Variables

  * 9.7. Odds and Ends

  * 9.8. Iterators

  * 9.9. Generators

  * 9.10. Generator Expressions

* 10. Brief Tour of the Standard Library

  * 10.1. Operating System Interface

  * 10.2. File Wildcards

  * 10.3. Command Line Arguments

  * 10.4. Error Output Redirection and Program Termination

  * 10.5. String Pattern Matching

  * 10.6. Mathematics

  * 10.7. Internet Access

  * 10.8. Dates and Times

  * 10.9. Data Compression

  * 10.10. Performance Measurement

  * 10.11. Quality Control

  * 10.12. Batteries Included

* 11. Brief Tour of the Standard Library --- Part II

  * 11.1. Output Formatting

  * 11.2. Templating

  * 11.3. Working with Binary Data Record Layouts

  * 11.4. Multi-threading

  * 11.5. Logging

  * 11.6. Weak References

  * 11.7. Tools for Working with Lists

  * 11.8. Decimal Floating Point Arithmetic

* 12. Virtual Environments and Packages

  * 12.1. Introduction

  * 12.2. Creating Virtual Environments

  * 12.3. Managing Packages with pip

* 13. What Now?

* 14. Interactive Input Editing and History Substitution

  * 14.1. Tab Completion and History Editing

  * 14.2. Alternatives to the Interactive Interpreter

* 15. Floating Point Arithmetic:  Issues and Limitations

  * 15.1. Representation Error

* 16. Appendix

  * 16.1. Interactive Mode

    * 16.1.1. Error Handling

    * 16.1.2. Executable Python Scripts

    * 16.1.3. The Interactive Startup File

    * 16.1.4. The Customization Modules
