[Scipy-tickets] [SciPy] #1014: UnivariateSpline objects should work on an empty array?

SciPy Trac scipy-tickets@scipy....
Sat Jul 17 08:50:04 CDT 2010

#1014: UnivariateSpline objects should work on an empty array?
  Reporter:  lebigot            |       Owner:  somebody                    
      Type:  defect             |      Status:  reopened                    
  Priority:  normal             |   Milestone:  Unscheduled                 
 Component:  scipy.interpolate  |     Version:  0.7.0                       
Resolution:                     |    Keywords:  UnivariateSpline empty array
Changes (by lebigot):

  * status:  closed => reopened
  * resolution:  invalid =>


 I guess I was not clear enough: the problem is not about
 UniveriateSpline(), but about the resulting spline not being able to take
 an empty array.

 In fact, the created spline behaves apparently like most (if not all)
 mathematical functions: it can take a single float, or an array of floats.
 I would contend that NumPy users are very much used to the fact that all
 these functions also yield [] when applied to an empty list that the
 resulting spline should behave in the same way.  Furthermore, Python's map
 behaves in the same way, as does list comprehension.

 So, what does matter is not the few functions that may have an exceptional
 behavior with respect to empty lists, but that heavily used NumPy or
 Python functions return an empty list when given an empty list of

 Simplicity and regularity of behavior is in fact much more convenient that
 unexpected, exceptional behavior: it really would be great that the spline
 created by UnivariateSpline behave in the usual way when given an empty
 list of arguments.  I strongly suggest that this "normal" feature be
 implemented for the spline returned by UnivariateSpline, so that users
 don't have their code raise an exception on corner cases, which is
 particularly painful when it happens after a long calculation.  This
 change would definitely make SciPy more convenient and simple to use.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1014#comment:3>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list