[IPython-dev] wildcard patch

Fernando Perez Fernando.Perez at colorado.edu
Mon Nov 14 15:02:07 EST 2005

Jörgen Stenarson wrote:
> Fernando Perez wrote:
>>I promise not to commit anything until I actually provide you with the 
>>rc option, so the system will never default to case-sensitive without 
>>giving you the option to get the behavior you like.  Since you wrote 
>>this to begin with, I think it's the least I can do :)
>>How does that sound?
> Sounds good to me

OK, glad you like that one.  What comes next is worse :)

I've been working on the wildcard code some, and I started to dislike the 
existing API a little, for consistency/maintainability reasons.  The magic 
functions have an option parsing system based on the stdlib's getopt(), and 
provide uniform unix-like syntax:

%cmd -opt1 -opt2 -opt_with_value=foo  arg1 arg2 ...

Currently, the wildcard system makes up its own unique syntax, using - both 
for options (c/a) and to delete namespaces from the search list.  I really 
don't like special cases such as this, and I apologize for not having thought 
more carefully about this earlier.  I like the functionality a lot, and I 
didn't want  to discourage you from contributing, so I think I didn't pass a 
picky enough comb over the original implementation.

I think we should clean this up a little, even at the cost of introducing 
slightly more verbose syntax.  As the Zen of pyhton says:

Special cases aren't special enough to break the rules.

Here's a patch that begins to implement that.  The docstrings aren't fixed 
yet, the ipythonrc option isn't implemented yet, and I'll work more on your 
code.  But you can test it a little and let me know what you think.  Now 
things are

%psearch [-e exclude1 -s search_add1 -i -a]  PATTERN [TYPESPEC]

So intstead of -/+ you use -e/-s to exclude/search namespaces.

Let me know what you think of this as I rework it...


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wildcard_fp.patch
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20051114/25614915/attachment.ksh>

More information about the IPython-dev mailing list