Paul Moore wrote:
Overall, I'm somewhat indifferent. The use case seems fairly specialised to me, and yet the syntax "def name = value" seems like it's worth reserving for something a bit more generally useful.
Not sure about the syntax, but I for one would find something like this useful for other purposes. For example, in some of my libraries I have a function that creates a special kind of property that needs to know its own name. Currently you have to write it like this: class Foo: blarg = overridable_property('blarg', "The blarginess of the Foo") which is an annoying DRY violation. Using the proposed syntax, it could be written class Foo: def blarg = overridable_property("The blarginess of the Foo")
Maybe the def name=value syntax should implement a protocol,
Hmmm. Maybe def name = value could turn into name = value.__def__('name', __name__) -- Greg