[Numpy-discussion] Propose modification to binary_repr

David Huard david.huard at gmail.com
Thu Dec 13 14:33:01 EST 2007


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 <oliphant at enthought.com>:
>
> 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 at scipy.org
> > http://projects.scipy.org/mailman/listinfo/numpy-discussion
> >
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071213/c455fb33/attachment.html>


More information about the NumPy-Discussion mailing list