[SciPy-user] convert shelved object back to dictionary

Fernando Perez Fernando.Perez at colorado.edu
Thu Oct 6 11:38:17 CDT 2005


Ryan Krauss wrote:
> Just about.  For some reason __dict__ didn't come up as an option when
> I typed user. and hit tab in Ipython, so I didn't know it was there. 
> The only slight problem with __dict__ is that it includes some
> properties like __builtins__ that I would like to filter out of the
> dictionary.

You can control whether tab-completion shows the single and double-underscore 
prefixed attributes of objects.  This is the relevant section in the 
~/.ipython/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 1


See what value you have for that, and set it to something you like.  Note that 
you can still see the underscored names regardless of this setting if you type 
a single underscore yourself, and THEN hit tab:

In [4]: a='hi'

In [5]: a.<TAB>
a.capitalize  a.expandtabs  a.islower     a.lower       a.rstrip      a.title
a.center      a.find        a.isspace     a.lstrip      a.split
[etc...]

In [5]: a._<TAB>
a.__add__           a.__getattribute__  a.__le__            a.__reduce__
a.__class__         a.__getitem__       a.__len__           a.__reduce_ex__
[etc...]

At runtime, you can see your whole ipython config state by simply typing %config.

Cheers,

f



More information about the SciPy-user mailing list