How about using lambda instead of @? lambda on its own currently raises a syntax error, so this might be easier to implement that @. Also, lambda is rather more descriptive than @ since it is already used in the context of unnamed functions.
I really like the proposal, although I would be interested to see if anyone can bikeshed up keywords that might be better than : or @… :-)
I do have some questions about it. Does using @ instead of the name defined below make the implementation easier? In other words, would this cause a NameError on normalize because normalize isn't defined in the local namespace?--
:sorted_list = sorted(original, key=normalize)
def normalize(item):
…
Or is the @ just for brevity? I assume the point is that it's not just brevity, but you have to use the @ in order to make the implementation straightforward.
-- Carl Johnson
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas