[IPython-dev] Tab-completion of data/properties and win32com fix for IPython
Fernando Perez
Fernando.Perez at colorado.edu
Tue Aug 3 00:20:05 EDT 2004
Jaco Schieke wrote:
> (Patch follows at the end of email)
I have some questions about this. I'll also make some general comments about
patches in a separate mail, please heed them for the future.
Since I may keep FlexCompleter around, I want to clarify a few things about
your patch.
>> def list2dict(l):
>> ret={}
>> for i in l:
>> ret[i] = None
>> return ret
>>
>
> 185a191,194
>
>> matches_dict = {}
>> matches_dict.update(list2dict(matches))
>> matches = matches_dict.keys()
>> matches.sort()
What exactly is all of this for? If you want to return the matches sorted, a
simple
matches.sort()
before returning will do just fine, no? Maybe I'm just tired now, but the
list2dict contortions seem unnecessary to me.
Besides, I think readline sorts itself always, since I always see the proposed
completions come out sorted. Could you clarify exactly what this is doing?
As far as I can tell, all of it is completely unnecessary.
> 188a198
>
> 192a203,208
>
>> try:
>> ret=ret+klass._prop_map_get_.keys()
>> ret=ret+klass._prop_map_put_.keys()
>> pass
>> except AttributeError:
>> pass
This could be acceptable, I imagine, for the benefit of win32 users. But not
in this form: all Win-specific code should be isolated at definition time, I
have no intention of making Unix users pay at runtime for windows-only stuff.
So you'd need to write instead something like:
def get_class_members():
--- current code ---
if on_windows:
# redefine with win-specific hacks
def get_class_members():
--- your windows code ---
or something similar. Be mindful of the details about cygwin vs non-cygwin
environments when writing windows-specific code, please. Also make sure you
test it very well, since I can't test it myself.
Best,
f
More information about the IPython-dev
mailing list