17.12.2012 Views

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Utilisation de as<br />

>>> class SomeContext(object):<br />

... def __enter__(self):<br />

... print('debut')<br />

... return self<br />

... def __exit__(self, *args):<br />

... print('fin')<br />

...<br />

>>> with SomeContext() as s:<br />

... print(str(s))<br />

... print('bloc')<br />

...<br />

debut<br />

<br />

bloc<br />

fin<br />

Syntaxe du langage<br />

CHAPITRE 4<br />

La bibliothèque standard fournit en outre un module contextlib, décrit dans le<br />

chapitre 10, qui détaille les utilitaires pour l’implémentation de ce protocole.<br />

En un mot...<br />

Python possède une syntaxe claire, concise et simple, et est doté de types standards<br />

très puissants.<br />

Le chapitre suivant couvre des éléments de syntaxe complémentaires, pour la structuration<br />

des programmes.<br />

95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!