[Numpy-discussion] Propose modification to binary_repr

2007-12-13 Thread David Huard
Hi, The current behavior of numpy's binary_repr is the following: binary_repr(1,width=2) '01' binary_repr(0,width=2) '0' This seems inconsistent and I'd suggest always padding with zeros to make sure that the return string always has length=width. Objections ? David

Re: [Numpy-discussion] resize in old Numeric

2007-12-13 Thread Christian Meesters
Thank you all for your valuable input. Learned something 'bout Numeric again. And my problem is solved ;-). Thanks Christian ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Traceback on divide by zero error

2007-12-13 Thread Robert Kern
Tony S Yu wrote: Hello, This is something that's been bothering for awhile. When numpy raises the following divide by zero error: Warning: divide by zero encountered in double_scalars is there a way to get a Traceback on where that warning occurred. In [1]: from numpy import * In [2]:

Re: [Numpy-discussion] Propose modification to binary_repr

2007-12-13 Thread David Huard
Change done. All tests pass. Should I document the change somewhere ? Although it's a small change, I'm guessing it could be very annoying to debug for someone depending on the previous behavior. 2007/12/13, Travis E. Oliphant [EMAIL PROTECTED]: David Huard wrote: Hi, The current

Re: [Numpy-discussion] Traceback on divide by zero error

2007-12-13 Thread Tony S Yu
On Dec 13, 2007, at 2:21 PM, Robert Kern wrote: Tony S Yu wrote: Hello, This is something that's been bothering for awhile. When numpy raises the following divide by zero error: Warning: divide by zero encountered in double_scalars is there a way to get a Traceback on where that warning

Re: [Numpy-discussion] Propose modification to binary_repr

2007-12-13 Thread Stefan van der Walt
On Thu, Dec 13, 2007 at 02:33:01PM -0500, David Huard wrote: Change done. All tests pass. Now's a good time to fix that :) Cheers Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

[Numpy-discussion] Faster array version of ndindex

2007-12-13 Thread Jonathan Taylor
I was needing an array representation of ndindex since ndindex only gives an iterator but array(list(ndindex)) takes too long. There is prob some obvious way to do this I am missing but if not feel free to include this code which is much faster. In [252]: time