Message312026
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>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2018-02-12 00:39:43 | ewosborne | set | recipients:
+ ewosborne, eric.smith |
2018-02-12 00:39:43 | ewosborne | link | issue32820 messages |
2018-02-12 00:39:43 | ewosborne | create | |
|