On Mon, 2011-09-26 at 22:43 -0400, Nick Coghlan wrote:
On Mon, Sep 26, 2011 at 9:32 PM, Guido van Rossum
wrote: Interesting discussion! Very enlightening.
Indeed! It has certainly clarified many aspects for me.
But after all that I'm still unconvinced that the new concept should be tied to the nonlocal keyword.
<snip>
For all these reasons, sorry Nick, but I really don't think any syntax based on nonlocal will do it, even "nonlocal <var> from <expr>".
I think I agree. It's close, but not close enough to what you want.
So I'm not prepared to completely give up on this one yet - it took me years of poking at the issue to come up with the idea of reusing nonlocal as the keyword, so I hope people will take some time to consider the idea of using the term to refer to variations in both visibility and lifecycle rather than strictly limiting it to refer only to the visibility aspect.
Don't give up just yet, I think you may just need an out of the box view point to see it from a different angle... Besides keywords, there is also syntax and or symbols. One of the things I like with python objects, is a symbol or operator, is really just a nicer way to call a method. Maybe this is option #3. ;-) Which reminds me... the '@' used for decorators doesn't follow that pattern. Too bad. If it did, it could be used for other things. The assignment nature of the '@' sort of fits this problem. def foo(x): @own {"y":12} #--> foo.__at__("own", **kwds): ... ... Ok, it's weird, I admit. @validate Anyway, this is just an idea example not to be taken too seriously. Maybe something could work in a similar way that doesn't require a keyword. Cheers, Ron