06.08.21 10:29, wyz2...@163.com пише:
> Before the introduction of bool and also in other languages, `not not x`
> was/is used to convert to True (1) and False (0). However, the old way is
> still much faster than bool(x) or even operator.truth(x).
> Test:
>> py -3.10 -m timeit -s "objects = 1,
On Fri, Aug 06, 2021 at 08:29:03AM -, wyz2...@163.com wrote:
> I thought that many places in stdlib could be made faster by this
> (bool is used a lot), maybe this is a major speedup.
I doubt that there are many places in the stdlib where the call to bool
is the bottleneck, and a
how does it compare with the old:
```
def rh(ham, _bool=bool):
return _bool(ham)
```
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
I thought that many places in stdlib could be made faster by this (bool is used
a lot), maybe this is a major speedup.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
On Fri, Aug 6, 2021 at 5:31 PM wrote:
>
> Before the introduction of bool and also in other languages, `not not x`
> was/is used to convert to True (1) and False (0). However, the old way is
> still much faster than bool(x) or even operator.truth(x).
> Test:
> > py -3.10 -m timeit -s "objects =