[NumPy-Tickets] [NumPy] #2100: Keyword argument support for vectorize.

NumPy Trac numpy-tickets@scipy....
Fri Apr 13 19:14:19 CDT 2012


#2100: Keyword argument support for vectorize.
---------------------------------------+------------------------------------
 Reporter:  mforbes                    |       Owner:  somebody    
     Type:  enhancement                |      Status:  needs_review
 Priority:  normal                     |   Milestone:  Unscheduled 
Component:  numpy.lib                  |     Version:  devel       
 Keywords:  vectorize kwargs keywords  |  
---------------------------------------+------------------------------------
Changes (by mforbes):

  * status:  new => needs_review


Comment:

 Here is a patch that is integrated into the main `vectorize` class.  It
 includes the following:

 API change:
  1. `vectorize` now supports vectorization over keyword arguments.
  2. Added new new optional kwargs:
     `argspec`::
          Allows the user to override automatic detection (for wrapped
 functions for example)
     `exclude`::
          A set of variables that will be excluded from vectorization.
  3. If `pyfunc.original_function` is defined, then this is used for
 getting documentation and the argspec.

 Additional changes:
  1. I need the `argspec`, so I added `_get_argspec()` that calls
 `inspect.getargspec()` and falls back to `_get_nargs()`.  Maybe these
 could be rolled together.
  2. I added the patch for issue #1156 with a regression test so that it
 can be closed too if accepted.
  3. Original `__call__` is now in `_vectorize_call`.  This is called
 directly unless `__call__` is passed keyword arguments, in which case the
 new code is executed which assembles the arguments into their proper
 positions and then calls `_vectorize_call`.
  4. `exclude` is implemented by creating a wrapper function with only the
 un-excluded positional arguments.  This is explicitly passed to
 `_vectorize_call` instead of `self.thefunc`.  The wrapper explicitly calls
 the original function with everything packed as a dictionary of keyword
 arguments for simplicity.

 Added documentation, as well as some tests.  All of the vectorize code is
 now covered by tests.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2100#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list