<div dir="ltr">Does __getattribute__ and __call__ basically accomplish this? You pass a "message name" to an object which it then uses to route to a handler which takes a tuple "message body" to process the message. It just happens that the syntax is obj.message_name(message, body, parts) instead of using << or >></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 19, 2013 at 11:58 AM, Ian Cordasco <span dir="ltr"><<a href="mailto:graffatcolmingov@gmail.com" target="_blank">graffatcolmingov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Mar 19, 2013 at 11:33 AM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
> I don't disagree with you, Nick, but I don't think that's what the OP is<br>
> looking for, either. Even using call syntax, it seems to me the OP would<br>
> still<br>
> only be sending one type of message, with no arguments, no differentiation,<br>
> no choices.<br>
<br>
</div>I understand OP wants to be able to send anything, but he seems to be<br>
disregarding how << and >> are currently implemented on objects (via<br>
__lshift__ and __rshift__ respectively). Each of those can be made in<br>
a custom fashion by OP (or anyone else) but the question then becomes,<br>
how do you add extra parameters (assuming you want them), i.e., how do<br>
you do:<br>
<br>
obj << 4, *extra_args<br>
<br>
I think (because I don't have a way of testing it right now) that<br>
you'd get an error for trying to expand extra_args in the creation of<br>
a tuple, regardless of the signature of __lshift__. Even if you didn't<br>
do that, I think python would interpret that as the creation of a<br>
tuple, i.e., the result of obj << 4 with the rest of the arguments.<br>
<div class="im"><br>
> To use the OP's own example:<br>
><br>
> some_collection(42)<br>
><br>
> would add 42 to the collection... but we have no say in where, or how. In<br>
> fact,<br>
> using call() notation we have less than the OP's proposal as his proposal<br>
> has a<br>
> one-way in and a one-way out, but an argument-less* call can only provide<br>
> one of<br>
> those two options.<br>
><br>
> --<br>
> ~Ethan~<br>
><br>
> *By argument-less I mean we can only give one thing to call.<br>
<br>
</div>And if we do this with the current implementation of python you can<br>
still only give one thing to call (assuming I'm correct with my above<br>
example). We would have to fundamentally change python and how it<br>
interprets those special cases (again basing the statement on my above<br>
assumptions/intuition). I'm sure in another language I would find this<br>
feature to be interesting or even appreciate it, but I don't think it<br>
is either very pythonic or useful in python. I'm also wondering if<br>
this is just a very well done troll since OP has yet to back any of<br>
his own examples which he thinks others are choosing to make his life<br>
difficult.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br></div>