On Aug 10, 2006, at 4:57 PM, Phillip J. Eby wrote:

> However, I'm also not clear that trying to assign to a function  
> call *is* ill-advised.  One of the things that attracted me to  
> Python in the first place is that it had a lot of features that  
> would be considered "hypergeneralization" in other languages, e.g.  
> the ability to create your own sequences, mappings, and callable  
> objects in the first place.
>
> That being said, the benefit of hypergeneralizing assignment seems  
> small compared to its price.

Well, it's a mostly obvious extension of an existing idea, so the  
price doesn't seem all that high. The main problem is that so far,  
there have been 0 convincing use cases. So no matter how moderate the  
price, it's definitely bigger than the benefit. But anyhow, speaking  
of hypergeneralization...since this has 0 use cases anyhow, might as  
well hyperhypergeneralize it...

Well, why should assignment be limited to only local variables, item  
access, and function calls. Why shouldn't you be able to potentially  
assign to _any_ expression!

Since
x + a turns into (very roughly...) x.__add__(a),

then,
x + a = 5 could turn into x.__add__.__setcall__(5, a).

Of course, since normal __add__ functions don't have a __setcall__,  
doing this will raise an error. But, a user defined __add__ could  
have one! And what would such a user defined __add__.__setcall__  
actually *do*? Well, that would be a use case, and I sure don't have  
any of those!

Ta Da. Who's going to make the patch? ;)

James
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to