[IPython-dev] object inspection behavior
dd55 at cornell.edu
Sat Oct 28 18:57:20 CDT 2006
On Saturday 28 October 2006 4:14 pm, Fernando Perez wrote:
> On 10/28/06, Darren Dale <dd55 at cornell.edu> wrote:
> > I was wondering if it is desireable (and possible) for object inspection
> > to hide attributes and methods that begin with a leading underscore.
> > For example, I have some code that reads a datafile with named columns
> > and returns an object with each data column as one of the objects
> > attributes. When I want to inspect the object to see what was recorded in
> > the file, I don't really need to see the __whatever__ methods that get
> > inherited from "object". I would also prefer not to list any methods or
> > attributes that the developer has masked with an underscore to make clear
> > they are not public.
> > Is it possible to modify ipython such that tab would not list these
> > methods/attributes, but perhaps something like ctrl+tab would?
> From the ipythonrc file:
> # (iii) readline_omit__names: normally hitting <tab> after a '.' in a name
> # will complete all attributes of an object, including all the special
> methods # whose names start with single or double underscores (like
> __getitem__ or # __class__).
> # This variable allows you to control this completion behavior:
> # readline_omit__names 1 -> completion will omit showing any names starting
> # with two __, but it will still show names starting with one _.
> # readline_omit__names 2 -> completion will omit all names beginning with
> one # _ (which obviously means filtering out the double __ ones).
> # Even when this option is set, you can still see those names by explicitly
> # typing a _ after the period and hitting <tab>: 'name._<tab>' will always
> # complete attribute names starting with '_'.
> # This option is off by default so that new users see all attributes of any
> # objects they are dealing with.
> readline_omit__names 0
> This should give you all the flexibility you need.
Ah, that was a bit of an oversite on my part. I should have known you would
have included support for this already, I didn't think to look in the rc
file. Thanks a lot!
More information about the IPython-dev