[IPython-dev] Default parameter completer

gsakkis at eden.rutgers.edu gsakkis at eden.rutgers.edu
Tue Apr 19 23:59:56 CDT 2005


Hello all,

I've written a matcher that provides the available default keyword arguments for
the most recent open call; check below for a snapshot of interactive usage. It's
not perfect (e.g. it cannot handle builtins), but I think it's adequate for most
cases.

I just subscribed to the list, so I have two questions on integrating new features:
- What's the procedure for adding a new feature to the official release (of
course if is deemed good, original and useful enough) ?
- If for any reason it can't make it to the official release, what's the
suggested way to integrate it in my own copy ? Currently I simply hacked
iplib.py, but I wonder if there's a more elegant way to add new functionality.

Thanks,
George


#=== Snapshot ========================================================

Python 2.4 (#1, Mar 29 2005, 15:15:45)
Type "copyright", "credits" or "license" for more information.

IPython 0.6.12 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]:%autoindent
Automatic indentation is: OFF

In [2]:def func(x, longDefaultArgumentFoo=0, longDefaultArgumentBar=None):
   ...:      pass
   ...:
In [3]:class Klass(object):
   ...:      def __init__(self, longDefaultInitArgument=""):
   ...:          pass
   ...:      def __call__(self, longDefaultCallArgument=-1):
   ...:          pass
   ...:      method = func
   ...:
In [4]:func(abs(3), lon
long                     longDefaultArgumentBar=  longDefaultArgumentFoo=

In [4]:func(abs(3), longD
longDefaultArgumentBar=  longDefaultArgumentFoo=

In [4]:func(abs(3), longDefaultArgumentFoo=34)

In [5]:obj = Klass(long
long                      longDefaultInitArgument=

In [5]:obj = Klass(longDefaultInitArgument=None)

In [6]:obj.method(longD
longDefaultArgumentBar=  longDefaultArgumentFoo=

In [6]:obj.method(longDefaultArgumentBar=0, longD
longDefaultArgumentBar=  longDefaultArgumentFoo=

In [6]:obj.method(longDefaultArgumentBar=0, longDefaultArgumentFoo=12)

In [7]:obj(long
long                      longDefaultCallArgument=

In [7]:obj(longDefaultCallArgument="")






More information about the IPython-dev mailing list