[IPython-User] Hide/disable magic commands

matt.clarke@stfc.... matt.clarke@stfc....
Sat Sep 10 10:17:51 CDT 2011


Thanks Fernando. That is a much better solution.

Matt
________________________________________
From: Fernando Perez [fperez.net@gmail.com]
Sent: 09 September 2011 17:59
To: Clarke, Matt (STFC,RAL,ISIS)
Cc: ipython-user@scipy.net
Subject: Re: [IPython-User] Hide/disable magic commands

On Fri, Sep 9, 2011 at 6:19 AM,  <matt.clarke@stfc.ac.uk> wrote:
> I have found a simple way of eliminating magic commands from tab complete
> but still allow the commands to be used by editing completer.py.
>
>
>
>         # All active matcher routines for completion
>
>         self.matchers = [self.python_matches,
>
>                          self.file_matches,
>
>                          self.magic_matches, <- delete this
>
>                          self.alias_matches,
>
>                          self.python_func_kw_matches,
>
>                          ]

Note that you can do this at runtime without having to hack the code:

ip = get_ipython()
ip.Completer.matchers.remove(ip.Completer.magic_matches)

You can put this into the profile for your users, enabling you to do
this customization while being able to update ipython normally.
Carrying a modified code is always a higher maintenance burden.

Cheers,

f
-- 
Scanned by iCritical.


More information about the IPython-User mailing list