GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Table des matières
  • 13. Pour aller plus loin
  • Signalement de bogue
  • Improve this page
  • Voir la source
  • index
  • modules
  • suivant
  • Python
  • 3.16.0a2 documentation
  • Le tutoriel Python

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — 14. Édition interactive des entrées et substitution d'historique

14. Édition interactive des entrées et substitution d'historique¶

Certaines versions de l'interpréteur Python prennent en charge l'édition de la ligne d'entrée courante et la substitution d'historique, similaires aux facilités que l'on trouve dans le shell Korn et dans le shell GNU Bash. Ces implémentations utilisent la bibliothèque GNU Readline, qui gère plusieurs styles d'édition. La bibliothèque a sa propre documentation, nous ne la dupliquons pas ici.

14.1. Complétion automatique et édition de l'historique¶

Completion of variable and module names is automatically enabled at interpreter startup so that the Tab key invokes the completion function; it looks at Python statement names, the current local variables, and the available module names. For dotted expressions such as string.a, it will evaluate the expression up to the final '.' and then suggest completions from the attributes of the resulting object. Note that this may execute application-defined code if an object with a __getattr__() method is part of the expression. The default configuration also saves your history into a file named .python_history in your user directory. The history will be available again during the next interactive interpreter session.

14.2. Alternatives à l'interpréteur interactif¶

This facility is an enormous step forward compared to earlier versions of the interpreter; however, some wishes are left: It would be nice if the proper indentation were suggested on continuation lines (the parser knows if an INDENT token is required next). The completion mechanism might use the interpreter's symbol table. A command to check (or even suggest) matching parentheses, quotes, etc., would also be useful.

Une alternative améliorée de l'interpréteur interactif est développée depuis maintenant quelques temps : IPython. Il fournit la complétion, l'exploration d'objets et une gestion avancée de l'historique. Il peut également être personnalisé en profondeur et embarqué dans d'autres applications. Un autre environnement interactif amélioré similaire est bpython.

© Copyright 2001 Python Software Foundation.
La licence de cette page est la Python Software Foundation License Version 2.
La licence des exemples, recettes, et autres morceaux de code se trouvant dans la documentation est la Zero Clause BSD License.
Pour plus d'informations, consultez Histoire et licence.

La Python Software Foundation est une association à but non lucratif. Elle vit de vos dons.

Dernière mise à jour : nov. 12, 2026 (05:04 UTC). Un bogue ?
Crée par Sphinx 9.1.1.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.