If I can, I want to back up the conversation a bit. Instead of starting
with a solution, what's the problem?

I believe the issue that this is trying to solve is that some functions
that operate on an object return a new object, and we would like to use
them to modify an object. Setting aside the fact that a new object is not
the same as a modified object and other references to that object won't
change, what this means is that we want to have a shorthand way to write:

(some reference to an object) = (an expression that operates on <some
reference to an object))


Note that the := operator solves a similar problem:

(an expression that references (some subexpression) multiple times)


where we can rewrite

blah blah (some subexpression) blah blah (some subexpression) blah (some
subexpression) blah

as

blah blah (X := (some subexpression)) blah blah X blah  X blah

That won't help us here because the two <some references to an object> are
respectively an lvalue and an rvalue.

Given that, I'll throw out a straw proposal. Since an lvalue can be
converted to an rvalue but not vice versa, suppose we rewrite this as:

(some reference) := X = <some expression using X>

example:

thing =: T = T.replace(before, after)


But looking at that, it really isn't much better unless the left hand side
is a very complicated expression. If we really needed a feature like this
it would be better to use a special symbol like:

thing = <>.replace(before,after)


Even then, how frequent is this pattern that it would be worth doing?

I think the answer to that question is going to be necessary to convince
anyone that the problem is worth solving.

--- Bruce
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YCZBBHVSGGWLKPTULWV4HGD4EM5NBNOF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to