[IPython-user] complete_object demo, OO file system browsing

Ville M. Vainio vivainio@gmail....
Fri Dec 28 10:24:00 CST 2007


As a fun hack / demo of complete_object generic function, fresh in svn
I added a pythonic way to browse file system:

http://ipython.scipy.org/ipython/ipython/changeset/2903

Here's what it looks like. My Windows start menu is under PathObj name
"startmenu" (see test_pathobj on how it was created):

[q:/ipython]|23> startmenu.Accessories. <TAB>
startmenu.Accessories.Communications
startmenu.Accessories.WordPadDOTlnk
startmenu.Accessories.desktopDOTini
startmenu.Accessories.CalculatorDOTlnk
startmenu.Accessories.System__Tools
startmenu.Accessories.PaintDOTlnk
startmenu.Accessories.Entertainment
startmenu.Accessories.Accessibility
startmenu.Accessories.Windows__Movie__MakerDOTlnk
startmenu.Accessories.Scanner__and__Camera__WizardDOTlnk
startmenu.Accessories.Media__Center

[q:/ipython]|23> startmenu.Accessories.Communications
---------------> startmenu.Accessories.Communications()
cd: d:/Documents and Settings/All Users/Start
Menu/Programs/Accessories/Communications
[d:Accessories/Communications]|24>
startmenu.Accessories.Communications.desktopDOTini
--------------------------------->
startmenu.Accessories.Communications.desktopDOTini()

This open the file desktop.ini in an editor (associated application,
launched via os.startfile).

__str__ is also implemented:

[d:Accessories/Communications]|25> print
startmenu.Accessories.Communications.desktopDOTini
d:/Documents and Settings/All Users/Start
Menu/Programs/Accessories/Communications/desktop.ini

An interesting/related custom completer might be something that
navigated xml DOM trees...

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'


More information about the IPython-user mailing list