Index: library/rlcompleter.rst =================================================================== --- library/rlcompleter.rst (revisione 83774) +++ library/rlcompleter.rst (copia locale) @@ -46,20 +46,26 @@ Completer Objects ----------------- +.. class:: Completer(namespace=None) + + *namespace* should be the :attr:`__dict__` + in the desidered namespace (like `builtins.__dict__`). If not provided, + :attr:`namespace` is set to `__main__.__dict__`. + + Completer objects have the following method: +.. method:: Completer.complete(text, state, use_builtins=True) -.. method:: Completer.complete(text, state) - Return the *state*\ th completion for *text*. - If called for *text* that doesn't include a period character (``'.'``), it will - complete from names currently defined in :mod:`__main__`, :mod:`builtins` and - keywords (as defined by the :mod:`keyword` module). + :meth:`complete` will search from names currently defined in :attr:`namespace`, + set during initialization. If *use_builtins* is :const:`True`, searches also + through the :meth:`builtins` namespace. - If called for a dotted name, it will try to evaluate anything without obvious - side-effects (functions will not be evaluated, but it can generate calls to - :meth:`__getattr__`) up to the last part, and find matches for the rest via the - :func:`dir` function. Any exception raised during the evaluation of the - expression is caught, silenced and :const:`None` is returned. + If *text* contains a dotted name, it will try to evaluate anything without + obvious side-effects (functions will not be evaluated, but it can generate + calls to :meth:`__getattr__`) up to the last part, and find matches for the + rest via the :func:`dir` function. Any exception raised during the evaluation + of the expression is caught, silenced and :const:`None` is returned.