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

I find a common idiom in Python is:

x = x or 'some other value'

This is highly reminiscent of the problem inplace operators solve.

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

x or= 'some other value'

?

Thanks,

Cammil
I have used the idiom sometimes:
    Dir = Dir or os.curdir
    FileSpec = FileSpec or '*'
But I think using an or= operator looks bad and obscure.  And it's one more thing to learn when learning Python.
Rob Cliffe
_______________________________________________
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