Fwd: PEP: add a `no` keyword as an alias for `not`

Grant Edwards grant.b.edwards at gmail.com
Thu Aug 1 17:41:16 EDT 2019


On 2019-08-01, Daniel Okey-Okoro <danielokeyokoro at gmail.com> wrote:

> But in many cases, when people write `if not val` they're checking if the
> val is `None`
>
> i.e. `if val is None`, `if val == None`

If they want to know if val is None, then they should be typing 'val
is None'.  IMO, it's not an improvement to let them type 'no val'
instead of 'not val' when what they really mean is 'val is None'.

> (so in effect it's kind of like they're checking if "something isn't
> there")

Except there _is_ something there.  It just has a 'false' value in the
case of 'not val' or it's the None singleton object in the 'val is
None'.

Something not being there is a whole different thing...

-- 
Grant Edwards               grant.b.edwards        Yow! My mind is making
                                  at               ashtrays in Dayton ...
                              gmail.com            




More information about the Python-list mailing list