This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ewosborne
Recipients christian.heimes, eric.smith, ewosborne, ncoghlan, serhiy.storchaka
Date 2018-02-12.16:10:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CA+97oKNHGfKbdOPMAYmQDuj69iS2yV60poGoP9QhcCQcRwsofw@mail.gmail.com>
In-reply-to <1518443173.12.0.467229070634.issue32820@psf.upfronthosting.co.za>
Content
IPv6 is nasty no matter how you do it (cf.
https://tools.ietf.org/html/rfc1924).  And the ipaddr library already has
hex (packed()).

Binary's not about direct readabilty, but about ease of comparison.  It's
much easier to show the reader

'0b00000001000000100000001100000100'
'0b00000001000000100000001100000011'
'0b11111111111111111111111111111100'

and have them figure out whether the mask contains both hosts than to show
them

'1.2.3.4'
'1.2.3.3'
'255.255.255.252'
and ask them to convert to binary in their heads.  Without the zero padding
on the left, this is very easy to get wrong.

But I certainly agree that this is somewhat niche and a convenience
function, and if the consensus is that this is too narrow for stdlib, so be
it.

eric

On Mon, Feb 12, 2018 at 8:46 AM Serhiy Storchaka <report@bugs.python.org>
wrote:

>
> Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment:
>
> I wouldn't say that
> "0b00000000000000010000110110111000100001011010001100000000000000000000000000000000100010100010111000000011011100000111001100110100"
> is a very human readable. For more readability it is better to group digits
> by 4 or 8, and why not use hexadecimal then?
>
> In any case the application of this feature looks pretty narrow to me. And
> since it can be implemented as a one-line function, I think it shouldn't be
> added in the stdlib. The ipaddress classes are already complex.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue32820>
> _______________________________________
>
History
Date User Action Args
2018-02-12 16:10:44ewosbornesetrecipients: + ewosborne, ncoghlan, eric.smith, christian.heimes, serhiy.storchaka
2018-02-12 16:10:44ewosbornelinkissue32820 messages
2018-02-12 16:10:43ewosbornecreate