Hi

I'm new to that list, hope, that my idea will be helpfull.

  hi = hi OR len(a)
> ---
> where (A OR B) returns A if A is not None, otherwise it returns B.
>

Probably, we can introduce syntactic sugar for "if not equal" comparison?
Not only for "is not None" check, but for comparison with any expression.

Something like:

x = foo if 'value': bar

equal to :

x = foo if foo != 'value' else bar

so, expression:

x = foo if foo is not None else bar

become:

x = foo if None: bar

That syntax does not use new keywords or operators, looks pythonic and
simplify most common "is not None" expression.

-- 
Regards,

Aliaksei Yaletski.

Homepage: http://tiendil.org
Skype: Tiendil
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to