[IPython-user] Request for a magic function to hide private function in tab completion
Wong, Shin Guey
Fri May 22 22:44:33 CDT 2009
I just found from the Ipython reference doc that this feature already built-in in Ipython:
readline_omit__names: when tab-completion is enabled, hitting <tab> after a ‘.’ in a name will complete all attributes of an object, including all the special methods whose names include double underscores (like __getitem__ or __class__). If you’d rather not see these names by default, you can set this option to 1. Note that 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 ‘_’.
From: Wong, Shin Guey
Sent: Saturday, May 23, 2009 10:47 AM
To: 'Gökhan SEVER'
Subject: RE: [IPython-user] Request for a magic function to hide private function in tab completion
Thanks for the links. I should read the reference doc before asking this question ☹
For ur question, showing all the private functions is useful for developer. But I have some users who is only use IPython to do some simple stuff, when they hit tab and it shows all the private functions which shouldn’t call by them, this will be really confusing for them if they don’t have good understanding on python program. So, I am thinking to have a magic function that can turn on/off the private function in tab completion. So, a normal user can have a much cleaner tab completion to show all the functions they can call but not all the private function which shouldn’t call by them.<actually we do have another interactive python which has this feature but it is not compatible with IPython because it will crash with IPython tab completion>
From: Gökhan SEVER [mailto:email@example.com]
Sent: Friday, May 22, 2009 10:33 PM
To: Wong, Shin Guey
Subject: Re: [IPython-user] Request for a magic function to hide private function in tab completion
Wouldn't this be destructive to general use of the IPython?
Say we type 5 and a "." (dot) following 5 and hit tab all the helpers are in type of private. Of course this is just a simple example, who needs __mul__() while there is "*". I am sure many base types have only helpers of that type.
There is a section in IPython documentation regarding to defining your own magic functions. (Magic command system)
On Fri, May 22, 2009 at 5:03 AM, Wong, Shin Guey <firstname.lastname@example.org<mailto:email@example.com>> wrote:
Is it possible to add a magic function like %hideprivate so it will hide all private function in python code completion.
All the function name start with _ or __ like <__file__ , _name> will not show when user press <tab> completion.
Or maybe can somebody provide hint on:
1. how to add new magic function
2. how to modify the code completion
IPython-user mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-user