[Python-Dev] rlcompleter -- auto-complete dictionary keys (+ tests)

Valery Khamenya khamenya at gmail.com
Sun Nov 7 11:19:11 CET 2010


Hi,

A) I missed the auto-complete feature for dictionary keys a lot in python
console. This patch seems to do the job.

B) There is no rlcompleter tests in trunk for some reason. So, I've taken
the 2.7.x test_rlcompleter.py and extended it.

C) patched rlcompleter as such works OK for unicode dictionary keys as well.
All tests pass OK. HOWEVER, readline's completion mechanism seem to be
confused with unicode strings -- see comments to
Completer.dict_key_matches(). So, perhaps, some changes should be applied to
readline code too.

Attached:

1. rlcompleter.py (as for trunk)

2. test_rlcompleter (as for trunk)

3. rlcompleter_trunk_to_new.diff (created as: diff rlcompleter_trunk.py
rlcompleter.py >rlcompleter_trunk_to_new.diff)

P.S. thanks to kerio & ssbr on icq for advices.

best regards
--
Valery A.Khamenya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101107/8eec0fc4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rlcompleter.py
Type: text/x-python
Size: 9001 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101107/8eec0fc4/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_rlcompleter.py
Type: text/x-python
Size: 6134 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101107/8eec0fc4/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rlcompleter_trunk_to_new.diff
Type: text/x-patch
Size: 3674 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101107/8eec0fc4/attachment.bin>


More information about the Python-Dev mailing list