Do not promote `None` as the first argument to `filter` in documentation.
On Wed, Mar 7, 2018 at 2:33 AM, Kirill Balunov <kirillbalunov at gmail.com> wrote:
> 2018-03-06 17:55 GMT+03:00 Chris Angelico <rosuav at gmail.com>:
>> If the first argument is None, the identity function is assumed. That
>> is, all elements of the iterable that are false are removed; it is
>> equivalent to (item for item in iterable if item). It is approximately
>> equivalent to (but faster than) filter(bool, iterable).
> If you look in C source for `filter_next`
> there is a line:
> int checktrue = lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type;
> So the only difference between `filter(None, ls`) and `filter(bool, ls)` is
> LOAD_NAME vs LOAD_CONST and that `None` is checked before than `bool`.
Assuming that nobody's shadowed the name 'bool' anywhere, which has to
be checked for at run time. (Which is the job of LOAD_NAME.)