[Python-Dev] Defining properties - a use case for class decorators?
Nick Coghlan
ncoghlan at gmail.com
Wed Oct 19 11:47:17 CEST 2005
Phillip J. Eby wrote:
> Note that a "where" or "given" statement like this could make it a
> little easier to drop lambda.
I think the "lambda will disappear in Py3k" concept might have been what
triggered the original 'where' statement discussion.
The idea was to be able to lift an arbitrary subexpression out of a function
call or assignment statement without having to worry about affecting the
surrounding namespace, and without distracting attention from the original
statement. Basically, let a local refactoring *stay* local.
The discussion wandered fairly far afield from that original goal though.
One reason it fell apart was trying to answer the seemingly simple question
"What would this print?":
def f():
a = 1
b = 2
print 1, locals()
print 3, locals() given:
a = 2
c = 3
print 2, locals()
print 4, locals()
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.blogspot.com
More information about the Python-Dev
mailing list