May 13, 2013
5:14 p.m.
On 05/13/2013 05:03 PM, Greg Ewing wrote:
I'd like to propose something a bit different:
def name as expr(arg, ...)
which would expand to something like
name = expr(arg, ..., __name__ = 'name', __module__ = 'module')
For example,
def Animal as Enum('cat dog platypus')
This reads quite naturally: "define Animal as an Enum with these arguments."
Another example based on my own use case:
def width as overridable_property("The width of the widget.")
+1 for the idea
(Yes, this is yet another, different use of the word "as", but I don't see anything wrong with that. Small words in English often don't mean much on their own and derive most of their meaning from their context.)
and another +1 :) -- ~Ethan~