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 eric.smith, ewosborne
Date 2018-02-12.00:39:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CA+97oKMbYmYcjfbmLKq7-Ci6xb6gGDHKQKq52-EpeccrzeXE6g@mail.gmail.com>
In-reply-to <1518391307.75.0.467229070634.issue32820@psf.upfronthosting.co.za>
Content
Faster, too.
My way:
In [7]: %timeit bits(a)
1.67 µs ± 7.31 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

Your way:
In [11]: %timeit b2(a)
1.2 µs ± 5.93 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

I was a little worried about doing it all as a clever one-liner but this
seems worthwhile.  I'll change the code I submitted.
thanks!

eric

On Sun, Feb 11, 2018 at 6:21 PM Eric V. Smith <report@bugs.python.org>
wrote:

>
> Eric V. Smith <eric@trueblade.com> added the comment:
>
> Without commenting on how useful or desirable this would be, I'll point
> out the string can be computed as:
>
> return f'{int(self):#0{IPV4LENGTH+2}b}'
>
> ----------
> nosy: +eric.smith
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue32820>
> _______________________________________
>
History
Date User Action Args
2018-02-12 00:39:43ewosbornesetrecipients: + ewosborne, eric.smith
2018-02-12 00:39:43ewosbornelinkissue32820 messages
2018-02-12 00:39:43ewosbornecreate