You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So length defaults to i.bit_length():
>>> s = Bits(uint=44)
>>> s.len
6
Can also be done for uintle, uintbe, uintne (rounding up to whole byte).
Not sure it makes sense for int etc., although bit_length() does work for
negative integers, so it might be fine.
Note that (0).bit_length() == 0, which is something to think about - should
zero need at least one bit or should we let it be an empty bitstring?
Original issue reported on code.google.com by dr.scott...@gmail.com on 24 Aug 2010 at 10:53
The text was updated successfully, but these errors were encountered:
On reflection I don't like the lack of an explicit length and don't think this
change would be very useful. Better just to say bin(x) for most use cases...
Original comment by dr.scott...@gmail.com on 18 Jun 2011 at 6:28
Original issue reported on code.google.com by
dr.scott...@gmail.com
on 24 Aug 2010 at 10:53The text was updated successfully, but these errors were encountered: