On 26/03/18 13:48, Cammil Taank wrote:
Hi,

I find a common idiom in Python is:

x = x or 'some other value'

I believe this is a historic idiom from back before the ternary operator was added to Python:

  x = x if x else 'some other value'

though honestly both of those are poor ways of spelling

  if not x:
     x = 'some other value'

This is highly reminiscent of the problem inplace operators solve.

It really isn't, particularly not in Python

Would it be a good idea to consider an inplace operator for this, perhaps:

x or= 'some other value'

I don't find the combination of letters and symbols appealing, sorry.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
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