Re: [Numpy-discussion] arr.copy(order='F') doesn't agree with docstring: what is intended behavior?

2010-06-27 Thread Pauli Virtanen
Sun, 27 Jun 2010 13:41:23 -0500, Kurt Smith wrote:
[clip]
> I misspoke (mistyped...).  So long as it has the 'F' behavior I'm happy,
> and I'll gladly file a bug report & patch to get the code to match the
> docs, assuming that's the intended behavior.

The problem is probably that the function is using PyArg_ParseTuple 
instead of PyArg_ParseTupleAndKeywords

> Who do I contact about getting a trac account?

Go to http://projects.scipy.org/numpy/ and select "Register".

-- 
Pauli Virtanen

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] arr.copy(order='F') doesn't agree with docstring: what is intended behavior?

2010-06-27 Thread Kurt Smith
On Sun, Jun 27, 2010 at 1:03 PM, David Goldsmith
 wrote:
> On Sun, Jun 27, 2010 at 10:38 AM, Kurt Smith  wrote:
>>
>> On Sat, Jun 26, 2010 at 7:34 PM, Warren Weckesser
>>  wrote:
>> > Kurt Smith wrote:
>> >> I'd really like arr.copy(order='F') to work -- is it supposed to as
>> >> its docstring says, or is it supposed to raise a TypeError as it does
>> >> now?
>> >>
>> >
>> > It works for me if I don't use the keyword.  That is,
>> >
>> >  >>> b = a.copy('F')
>>
>> Great!  At least the functionality is there.
>>
>> >
>> > But I get the same error if I use order='F', so there is a either a bug
>> > in the docstring or a bug in the code.
>>
>> I certainly hope it's a docstring bug and not otherwise.
>>
>> Any pointers on submitting documentation bugs?
>>
>> Kurt
>
> Same as filing a code bug: file a ticket at projects.scipy.org/numpy,  But
> the policy is to document desired behavior, not actual behavior (if the code
> isn't behaving as advertised but it should, obviously that's a code bug), so
> you can do one of two things: a) wait 'til someone replies here clarifying
> which it is, or b) file a ticket which describes the inconsistency and let
> the issue be worked out over there (preferred IMO 'cause it gets the ticket
> filed while the issue is fresh in your mind, and any discussion of what kind
> of bug it is gets recorded as part of the ticket history).  Thanks for
> reporting/filing!

I misspoke (mistyped...).  So long as it has the 'F' behavior I'm
happy, and I'll gladly file a bug report & patch to get the code to
match the docs, assuming that's the intended behavior.

Who do I contact about getting a trac account?

Thanks,

Kurt

>
> DG
>
>>
>> >
>> > Warren
>> >
>> >
>> >> This is on numpy 1.4
>> >>
>> >>
>> > import numpy as np
>> > a = np.arange(10).reshape(5,2)
>> > a
>> >
>> >> array([[0, 1],
>> >>        [2, 3],
>> >>        [4, 5],
>> >>        [6, 7],
>> >>        [8, 9]])
>> >>
>> > print a.copy.__doc__
>> >
>> >> a.copy(order='C')
>> >>
>> >>     Return a copy of the array.
>> >>
>> >>     Parameters
>> >>     --
>> >>     order : {'C', 'F', 'A'}, optional
>> >>         By default, the result is stored in C-contiguous (row-major)
>> >> order in
>> >>         memory.  If `order` is `F`, the result has 'Fortran'
>> >> (column-major)
>> >>         order.  If order is 'A' ('Any'), then the result has the same
>> >> order
>> >>         as the input.
>> >>
>> >>     Examples
>> >>     
>> >>     >>> x = np.array([[1,2,3],[4,5,6]], order='F')
>> >>
>> >>     >>> y = x.copy()
>> >>
>> >>     >>> x.fill(0)
>> >>
>> >>     >>> x
>> >>     array([[0, 0, 0],
>> >>            [0, 0, 0]])
>> >>
>> >>     >>> y
>> >>     array([[1, 2, 3],
>> >>            [4, 5, 6]])
>> >>
>> >>     >>> y.flags['C_CONTIGUOUS']
>> >>     True
>> >>
>> > a.copy(order='C')
>> >
>> >> Traceback (most recent call last):
>> >>   File "", line 1, in 
>> >> TypeError: copy() takes no keyword arguments
>> >>
>> > a.copy(order='F')
>> >
>> >> Traceback (most recent call last):
>> >>   File "", line 1, in 
>> >> TypeError: copy() takes no keyword arguments
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] arr.copy(order='F') doesn't agree with docstring: what is intended behavior?

2010-06-27 Thread David Goldsmith
On Sun, Jun 27, 2010 at 10:38 AM, Kurt Smith  wrote:

> On Sat, Jun 26, 2010 at 7:34 PM, Warren Weckesser
>  wrote:
> > Kurt Smith wrote:
> >> I'd really like arr.copy(order='F') to work -- is it supposed to as
> >> its docstring says, or is it supposed to raise a TypeError as it does
> >> now?
> >>
> >
> > It works for me if I don't use the keyword.  That is,
> >
> >  >>> b = a.copy('F')
>
> Great!  At least the functionality is there.
>
> >
> > But I get the same error if I use order='F', so there is a either a bug
> > in the docstring or a bug in the code.
>
> I certainly hope it's a docstring bug and not otherwise.
>
> Any pointers on submitting documentation bugs?
>
> Kurt
>

Same as filing a code bug: file a ticket at projects.scipy.org/numpy,  But
the policy is to document desired behavior, not actual behavior (if the code
isn't behaving as advertised but it should, obviously that's a code bug), so
you can do one of two things: a) wait 'til someone replies here clarifying
which it is, or b) file a ticket which describes the inconsistency and let
the issue be worked out over there (preferred IMO 'cause it gets the ticket
filed while the issue is fresh in your mind, and any discussion of what kind
of bug it is gets recorded as part of the ticket history).  Thanks for
reporting/filing!

DG


>
> >
> > Warren
> >
> >
> >> This is on numpy 1.4
> >>
> >>
> > import numpy as np
> > a = np.arange(10).reshape(5,2)
> > a
> >
> >> array([[0, 1],
> >>[2, 3],
> >>[4, 5],
> >>[6, 7],
> >>[8, 9]])
> >>
> > print a.copy.__doc__
> >
> >> a.copy(order='C')
> >>
> >> Return a copy of the array.
> >>
> >> Parameters
> >> --
> >> order : {'C', 'F', 'A'}, optional
> >> By default, the result is stored in C-contiguous (row-major)
> order in
> >> memory.  If `order` is `F`, the result has 'Fortran'
> (column-major)
> >> order.  If order is 'A' ('Any'), then the result has the same
> order
> >> as the input.
> >>
> >> Examples
> >> 
> >> >>> x = np.array([[1,2,3],[4,5,6]], order='F')
> >>
> >> >>> y = x.copy()
> >>
> >> >>> x.fill(0)
> >>
> >> >>> x
> >> array([[0, 0, 0],
> >>[0, 0, 0]])
> >>
> >> >>> y
> >> array([[1, 2, 3],
> >>[4, 5, 6]])
> >>
> >> >>> y.flags['C_CONTIGUOUS']
> >> True
> >>
> > a.copy(order='C')
> >
> >> Traceback (most recent call last):
> >>   File "", line 1, in 
> >> TypeError: copy() takes no keyword arguments
> >>
> > a.copy(order='F')
> >
> >> Traceback (most recent call last):
> >>   File "", line 1, in 
> >> TypeError: copy() takes no keyword arguments
> >>
> >> ___
> >> NumPy-Discussion mailing list
> >> NumPy-Discussion@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >>
> >
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
Mathematician: noun, someone who disavows certainty when their uncertainty
set is non-empty, even if that set has measure zero.

Hope: noun, that delusive spirit which escaped Pandora's jar and, with her
lies, prevents mankind from committing a general suicide.  (As interpreted
by Robert Graves)
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] arr.copy(order='F') doesn't agree with docstring: what is intended behavior?

2010-06-27 Thread Kurt Smith
On Sat, Jun 26, 2010 at 7:34 PM, Warren Weckesser
 wrote:
> Kurt Smith wrote:
>> I'd really like arr.copy(order='F') to work -- is it supposed to as
>> its docstring says, or is it supposed to raise a TypeError as it does
>> now?
>>
>
> It works for me if I don't use the keyword.  That is,
>
>  >>> b = a.copy('F')

Great!  At least the functionality is there.

>
> But I get the same error if I use order='F', so there is a either a bug
> in the docstring or a bug in the code.

I certainly hope it's a docstring bug and not otherwise.

Any pointers on submitting documentation bugs?

Kurt

>
> Warren
>
>
>> This is on numpy 1.4
>>
>>
> import numpy as np
> a = np.arange(10).reshape(5,2)
> a
>
>> array([[0, 1],
>>        [2, 3],
>>        [4, 5],
>>        [6, 7],
>>        [8, 9]])
>>
> print a.copy.__doc__
>
>> a.copy(order='C')
>>
>>     Return a copy of the array.
>>
>>     Parameters
>>     --
>>     order : {'C', 'F', 'A'}, optional
>>         By default, the result is stored in C-contiguous (row-major) order in
>>         memory.  If `order` is `F`, the result has 'Fortran' (column-major)
>>         order.  If order is 'A' ('Any'), then the result has the same order
>>         as the input.
>>
>>     Examples
>>     
>>     >>> x = np.array([[1,2,3],[4,5,6]], order='F')
>>
>>     >>> y = x.copy()
>>
>>     >>> x.fill(0)
>>
>>     >>> x
>>     array([[0, 0, 0],
>>            [0, 0, 0]])
>>
>>     >>> y
>>     array([[1, 2, 3],
>>            [4, 5, 6]])
>>
>>     >>> y.flags['C_CONTIGUOUS']
>>     True
>>
> a.copy(order='C')
>
>> Traceback (most recent call last):
>>   File "", line 1, in 
>> TypeError: copy() takes no keyword arguments
>>
> a.copy(order='F')
>
>> Traceback (most recent call last):
>>   File "", line 1, in 
>> TypeError: copy() takes no keyword arguments
>>
>> ___
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] arr.copy(order='F') doesn't agree with docstring: what is intended behavior?

2010-06-26 Thread Warren Weckesser
Kurt Smith wrote:
> I'd really like arr.copy(order='F') to work -- is it supposed to as
> its docstring says, or is it supposed to raise a TypeError as it does
> now?
>   

It works for me if I don't use the keyword.  That is,

 >>> b = a.copy('F')

But I get the same error if I use order='F', so there is a either a bug 
in the docstring or a bug in the code.

Warren


> This is on numpy 1.4
>
>   
 import numpy as np
 a = np.arange(10).reshape(5,2)
 a
 
> array([[0, 1],
>[2, 3],
>[4, 5],
>[6, 7],
>[8, 9]])
>   
 print a.copy.__doc__
 
> a.copy(order='C')
>
> Return a copy of the array.
>
> Parameters
> --
> order : {'C', 'F', 'A'}, optional
> By default, the result is stored in C-contiguous (row-major) order in
> memory.  If `order` is `F`, the result has 'Fortran' (column-major)
> order.  If order is 'A' ('Any'), then the result has the same order
> as the input.
>
> Examples
> 
> >>> x = np.array([[1,2,3],[4,5,6]], order='F')
>
> >>> y = x.copy()
>
> >>> x.fill(0)
>
> >>> x
> array([[0, 0, 0],
>[0, 0, 0]])
>
> >>> y
> array([[1, 2, 3],
>[4, 5, 6]])
>
> >>> y.flags['C_CONTIGUOUS']
> True
>   
 a.copy(order='C')
 
> Traceback (most recent call last):
>   File "", line 1, in 
> TypeError: copy() takes no keyword arguments
>   
 a.copy(order='F')
 
> Traceback (most recent call last):
>   File "", line 1, in 
> TypeError: copy() takes no keyword arguments
>   
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>   

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] arr.copy(order='F') doesn't agree with docstring: what is intended behavior?

2010-06-26 Thread Kurt Smith
I'd really like arr.copy(order='F') to work -- is it supposed to as
its docstring says, or is it supposed to raise a TypeError as it does
now?

This is on numpy 1.4

>>> import numpy as np
>>> a = np.arange(10).reshape(5,2)
>>> a
array([[0, 1],
   [2, 3],
   [4, 5],
   [6, 7],
   [8, 9]])
>>> print a.copy.__doc__
a.copy(order='C')

Return a copy of the array.

Parameters
--
order : {'C', 'F', 'A'}, optional
By default, the result is stored in C-contiguous (row-major) order in
memory.  If `order` is `F`, the result has 'Fortran' (column-major)
order.  If order is 'A' ('Any'), then the result has the same order
as the input.

Examples

>>> x = np.array([[1,2,3],[4,5,6]], order='F')

>>> y = x.copy()

>>> x.fill(0)

>>> x
array([[0, 0, 0],
   [0, 0, 0]])

>>> y
array([[1, 2, 3],
   [4, 5, 6]])

>>> y.flags['C_CONTIGUOUS']
True
>>> a.copy(order='C')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: copy() takes no keyword arguments
>>> a.copy(order='F')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: copy() takes no keyword arguments
>>>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion