[IPython-dev] Tab-completion of data/properties and win32com fix for IPython

Jaco Schieke ipython at ml.schieke.net
Thu Aug 5 17:35:50 EDT 2004


OK.  I need to convince you guys (any myself) first that there is a 
problem though. Here is the patch for a proof of concept... I think my 
previous description of the POC may have been ambiguous, as the change 
could have been implemted in more than one place in FlexCompleter.py.  
Having applied this to FlexCompleter.py (or even rlcompleter.py at the 
right place with a vanilla python shell), things like sys.<tab> fail on 
my system (dont have access to a proper linux system to test.)  Please 
apply and verify.

My diagnosis is that the error lies in pyreadline at 
\lib\site-packages\readline\pyreadline.py(788)_get_completions() with 
the line "if r and r not in completions:", since this will break as soon 
as a duplicate entry is detected.  But before we discuss this further, 
please verify that my POC is not due to a wacky configuration on my side.

Regards,

Jaco

Proof of concept for duplicate entry failure.  After applying, do in 
IPython: import sys; sys.<tab>

$ cvs -z3 diff -ut IPython/FlexCompleter.py
Index: IPython/FlexCompleter.py
===================================================================
RCS file: /home/cvsroot/world/ipython/IPython/FlexCompleter.py,v
retrieving revision 1.3
diff -u -t -r1.3 FlexCompleter.py
--- IPython/FlexCompleter.py    22 Aug 2003 16:04:33 -0000      1.3
+++ IPython/FlexCompleter.py    5 Aug 2004 21:48:17 -0000
@@ -183,6 +183,7 @@
         for word in words:
             if word[:n] == attr and word != "__builtins__":
                 matches.append("%s.%s" % (expr, word))
+        matches.sort()
         return matches
 
 def get_class_members(klass):


Gary Bishop wrote:

> I agree with Fernando. If pyreadline is different from GNU readline we 
> need to fix it. I have NEVER used GNU readline on Linux. I played with 
> it a bit on cygwin but didn't really know that I was doing when 
> writing it.
>
> I read the manual and tried to implement what I thought it does. Let's 
> make pyreadline work as much like the GNU readline as we can. I'll be 
> happy to accept patches to it.
>
> gb
>
>




More information about the IPython-dev mailing list