Eric Osborne <e...@notcom.com> added the comment:

redoing with a bits() property method to return a string, a la:

    def bits(self):
        fstr = '0' + str(IPV4LENGTH) + 'b'
        return '0b' + format(int(self), fstr)


Works thusly:

import ipaddress as ip
a = ip.IPv4Address('0.0.0.42')
a.bits == '0b00000000000000000000000000101010'

----------
resolution: rejected -> 
title: Add binary methods to ipaddress -> Add bits method to ipaddress

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32820>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to