[IPython-user] Inconsistency in "!!" ?

Asheesh Laroia asheesh at asheesh.org
Wed Jun 21 15:37:33 CDT 2006


I want to use ipython for as much as possible, so I thought I would try 
writing a shell-style for loop.  First I tested !!ls:

 	In [50]: !!ls
 	Out[50]:
 	['common.py',
 	 'domain.py',
 	 'histgraph.py',
 	 'language.py',
 	 'link-counts.py',
 	 'link-counts.sh',
 	 'postprocess.py',
 	 'sumgen.py',
 	 'tabgen.py']

That worked just fine.  So can I loop through these?

 	In [51]: for thing in !!ls:
 	------------------------------------------------------------
 	   File "<ipython console>", line 1
 	     for thing in !!ls:
 	                  ^
 	SyntaxError: invalid syntax

That's sad.  Is this expected behavior?  Is there some way I can get this 
to work anyway? (-:

Thanks all!

-- Asheesh.

-- 
Never put off till run-time what you can do at compile-time.
 		-- D. Gries




More information about the IPython-user mailing list