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

Daniel Okey-Okoro danielokeyokoro at gmail.com
Thu Aug 1 16:06:14 EDT 2019


I think that adding a `no` keyword as an alias for `not` would make for
more readable, simple, pythonic code.

Take the below:

```
if not val:
  do_thing_because_value_is_falsy()
```

could be (is actually understood as):

```
if no val:
   do_thing_because_value_is_falsy()
```

I think this PEP is a work-around for an underlying subtle issue with how
the `not` operator is used.

It has two use-cases:

1. as a NOT gate for producing opposite boolean values

```
opposite = not regular
```

2. as a sort of  ".is_falsy()"  checker; when used with an if statement.

like the first example.


This PEP would make the difference between the two usecases explicit.

Thoughts?

Best Intentions,
Daniel Okey-Okoro.



More information about the Python-list mailing list