[IPython-user] Hierarchical TAB completion?

John Pye john.pye@student.unsw.edu...
Thu Apr 5 07:51:21 CDT 2007

What about working on a "%with" magic function that somehow changes the
evaluation context (pushes a new sub-context onto a stack),

I'm thinking of the Javascript syntax here. Not sure if this sort of
thing would be easy in IPython or not.

I've no idea about the IPython internals; might not be feasible.


Ville M. Vainio wrote:
> On 4/3/07, Pierre Bielmann <pierre.bielmann@gmail.com> wrote:
>> Hi all,
>> Is it possible to implement (with iPython) a shell which behaves like a
>> classical
>> Router Command Line Shell (e.g. Cisco IOS shell, etc.)? I'd like to "enter"
>> objects in a hierachical
>> fashion and execute commands/methods and also have command line completion
>> only in that context
>> (and not globally). Here is a simple example of what I have in mind:
> http://ipython.scipy.org/moin/Cookbook/CustomCompleters
> Perhaps you could hook a completer method of your state-aware object
> as a re_key = '.*' (match all), so it would be "tried" for every
> command line. It would just see that it's currently in state 'user',
> and return appropriate completions.
> I.e. you have only one completer function, which just behaves
> differently depending on the state. Granted that it's not the most
> elegant solution.

John Pye
Department of Mechanical and Manufacturing Engineering
University of New South Wales, Sydney, Australia

More information about the IPython-user mailing list