+1 for accepting anything that quacks like a duck, it should be up to
the user to decide which data structure to use.

Fabian.

On 10/21/11, Robert Layton <[email protected]> wrote:
> On 21 October 2011 01:27, Gael Varoquaux
> <[email protected]>wrote:
>
>> On Thu, Oct 20, 2011 at 02:38:24PM +0200, Lars Buitinck wrote:
>> > REJECTING np.matrix by throwing a TypeError
>>
>> +1 on my side.
>>
>> G
>>
>>
>> ------------------------------------------------------------------------------
>> The demand for IT networking professionals continues to grow, and the
>> demand for specialized networking skills is growing even more rapidly.
>> Take a complimentary Learning@Ciosco Self-Assessment and learn
>> about Cisco certifications, training, and career opportunities.
>> http://p.sf.net/sfu/cisco-dev2dev
>> _______________________________________________
>> Scikit-learn-general mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>
>
> +1 for converting, mainly because we allow tuples and python lists as input.
> We should allow anything that quacks like a duck [1], which means anything
> that is allowed input to np.array as the first argument.
> >From [2], the description for the first argument is:
>
> *object* : array_like
>
> An array, any object exposing the array interface, an object whose __array__
> method returns an array, or any (nested) sequence.
>
> So I suggest we allow numpy to convert as we would for tuples, and if numpy
> doesn't like it, than neither do we, and reraise the error that happens.
> There is a slight sanity check that we need to ensure stays - if you do:
>>>> a = np.array(3)
>>>> a[0]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> IndexError: 0-d arrays can't be indexed
>
> Wrapping in np.atleast_2d will fix this (return a 1x1 array that can be
> indexed), but we need to ensure this sanity check stays.
> For all internal code though - I recommend we stay well away from using it
> in any function.
> Anyway, that is my 2c+,
>
> - Robert
>
> [1] http://en.wikipedia.org/wiki/Duck_typing
> [2] http://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html
>
> --
>
>
> My public key can be found at: http://pgp.mit.edu/
> Search for this email address and select the key from "2011-08-19" (key id:
> 54BA8735)
> Older keys can be used, but please inform me beforehand (and update when
> possible!)
>

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to