A thread on comp.lang.python details the problem: http://groups.google.com/groups? hl=en&threadm=b5ddd682.0204180902.2866a9c0% 40posting.google.com&rnum=1&prev=/groups%3Fhl%3Den% 26selm%3Db5ddd682.0204180902.2866a9c0% 2540posting.google.com rlcompleter.py does not expand correctly on something like: >>> sim[0]. since m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) does not allow for brackets in the match. I propose: m = re.match(r"([\w\[\]]+(\.[\w\[\]]+)*)\.(\w*)", text) to fix this on line 127 in cvs version 1.11
Logged In: YES user_id=670441 This isn't really a bug, as (at least currently) this behavior is mentioned in the documentation for rlcompleter (at least it's in the docstring). The reason a[0]. isn't completed is that we want to avoid executing arbitrary code. The current completion mechanism is already a bit dangerous as an object's getattr could be called to execute code with unknown side effects while completing. It just seems to dangerous to allow indexing, as lots of objects use this for their own purposes. If this behavior is determined desirable despite the danger, someone with commit privileges should say so, and then someone can submit a patch (I could do it). Probably this bug should just be closed.
Logged In: YES user_id=1188172 As the other commentors point out, this easily leads to execution of arbitrary code via __getitem__, which is IMHO a too big side effect of completing (though IPython does this). Recommend reject.