I would like to propose a new piece of syntax for the python language; .=

In short, the operator is form of syntactic sugar, for instance consider
the following code:

hello = "hello world              "
hello = hello.strip()

This could be written as:

hello = "hello world              "
hello .= strip()

In this slightly contrived example, the programmer saved (a small amount
of) time when writing the code. With code with longer variable names, or
lots of similar statements all in a row, this helps to keep code more
concise.

The operator would be constricted to one method or field on the right-hand
side, which must belong to the object on the left hand side.

Another example could be when using Linked Lists, instead of writing
something like:

loop_node = loop_node.next

you could write:

loop_node .= next

Does this idea have any chance of acceptance if submitted as a PEP? What
are the potential concerns I could consider with the syntax?

Thanks,

Jamie
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to