[Numpy-discussion] Propose modification to binary_repr

Travis E. Oliphant oliphant@enthought....
Thu Dec 13 10:17:55 CST 2007


David Huard wrote:
> 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 ?
>
This sounds like a good idea.   I don't think it would break anything, 
but it would be good to test.

-Travis O.

> ------------------------------------------------------------------------
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>   



More information about the Numpy-discussion mailing list