Hello,
I have a request.
Would it be possible to include `follow_wrapper_chains` and `skip_bound_arg`
arguments to higher level functions of `inspect` module?
Would exposing them, but setting defaults to what they currently are, be
possible?
I sometimes need:
* `getcallargs`, but with
On Sun, 3 Dec 2023 at 10:25, Julieta Shem via Python-list
wrote:
>
> Alan Bawden writes:
> >
> > def powers_of_2_in(n):
> > bc = (n ^ (n - 1)).bit_count() - 1
> > return bc, n >> bc
>
> That's pretty fancy and likely the fastest.
It might be the fastest but it depends how big you expect
Julieta Shem ha scritto:
jak writes:
[...]
--8<---cut here---start->8---
def powers_of_2_in(n):
if remainder(n, 2) != 0:
return 0, n
else:
s, r = powers_of_2_in(n // 2)
return 1 + s, r
--8<---cut here---end-
jak writes:
[...]
>> --8<---cut here---start->8---
>> def powers_of_2_in(n):
>>if remainder(n, 2) != 0:
>> return 0, n
>>else:
>> s, r = powers_of_2_in(n // 2)
>> return 1 + s, r
>> --8<---cut here---end--
Julieta Shem ha scritto:
Alan Bawden writes:
jak writes:
Alan Bawden ha scritto:
> Julieta Shem writes:
>
> How would you write this procedure?
> def powers_of_2_in(n):
> ...
>
> def powers_of_2_in(n):
> return (n ^ (n - 1)).bit_count
Alan Bawden writes:
> jak writes:
>
>Alan Bawden ha scritto:
>> Julieta Shem writes:
>>
>> How would you write this procedure?
>> def powers_of_2_in(n):
>> ...
>>
>> def powers_of_2_in(n):
>> return (n ^ (n - 1)).bit_count() - 1
>>
>