I like to test my code interactively in ipython. At the moment, by default when I load my libraries, I get all the static data members and all the functions loaded by default, meaning they can tab complete properly.
However, my classes don’t have their symbols loaded into the tab completion system by default. If I load them once by typing the name, tab completion after that works properly.
I understand that this is an intentional choice rather than a bug - but it’s one I’d like to customise. Is there a way I can make everything get loaded for tab completion whenever I load a library?
are you sure? At least for global classes, this looks like a bug to me, in ROOT.py … Fix diff:
gClassTable = _root.GetCppGlobal( 'gClassTable' )
< gClassTable = _root.GetCppGlobal( ‘gClassTable’ ).get(_root)[/code]
For classes in a namespace, the class table listing needs parsing, which would be best done by having classes grow a dir method as is in PyPy/cppyy.
Thanks for getting back to me so quickly. My understanding that this is intentional comes from a while back - I think this is what I was basing that view on:
If you want to make this default behaviour, I’d be pleased with that solution - I tend to use fully up-to-date versions. Otherwise, I’ll implement the change you described myself.
there’s a big difference between loading all the symbols and getting all available strings. In fact, a lot of work has gone into making things as lazy as possible on the interpreter side.
If you want it in, you should create a JIRA ticket and post the patch. Probably Danilo or Pere can take it from there.
Directed to here from a Google search on tab completion for PyROOT.
Actually I second the opinion that tab completion for all classes should be enabled, probably in the future releases? If you know what you will be using it does not matter, but if you want to play with it, why not showing all what’s there?
as said, what you ask for is supported, just that it is broken right now due to a bug, and the fix I posted above. I recommend filing a JIRA ticket to get it in.