[Python-ideas] an unless statement would occasionally be useful

Terry Reedy tjreedy at udel.edu
Sun May 17 21:04:51 CEST 2015


On 5/17/2015 2:07 PM, Charles Hixson wrote:
> I'm envisioning "unless" as a synonym for "if not(...):"  currently I use
>
> if .... :
>      pass
> else:
>    ...
>
> which works.
>
> N.B.:  This isn't extremely important as there are already two ways to
> accomplish the same purpose, but it would be useful, seems easy to
> implement, and is already used by many other languages.  The advantage
> is that when the condition is long it simplifies understanding.

We try not to bloat Python with minor synonyms. They make it harder to 
learn and remember the language and chose which synonym to use.


-- 
Terry Jan Reedy



More information about the Python-ideas mailing list