Ok agreed on .update and .extend. Two operators (+= and <==) doing the
same thing is dumb. And for .append I agree "this thing is the same, just
add this thing" is a little at odds with "update this thing when i send
this other thing into it".

> my_gen.send
>
> Sure, this makes sense to me!
>

I have to admit, I *kind of* love this one.


> If you have an operator for writing, you expect an
>
operator for reading too. But then, the analogy with += breaks down for me.
>

 For reading, can't you just switch the order?

fstream <== x  # write into existing stream
x <== fstream  # read into existing object (ie, this is NOT an assignment
type of action-- this might be confusing)

Worth pointing out that fstream is a type of iterator, so might writing
just be thought of as a specific case of sending into a generator?
Similarly: reading is yield from the generator. Of course you'd have a
battle to the death over whether the read should be Unicode based (reading
lines) or reading a byte at a time.

On the original topic: I was wondering the other day if the HDL thing could
most conveniently be implemented using a generator-like class that allows
things sent into it. But the .send syntax doesn't help the problem the OP
was trying to solve of ugly syntax.

I'm beginning to wonder of associating an operator with .send makes a lot
sense. I think I would definitely find code more readable with that kind of
syntax.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to