[Python-ideas] Assignment decorators (Re: The Descriptor Protocol...)

Guido van Rossum guido at python.org
Thu Mar 10 01:29:18 CET 2011


On Wed, Mar 9, 2011 at 6:12 PM, MRAB <python at mrabarnett.plus.com> wrote:
>    def foo = CharField(size=10, nullable=False)

Eek, it would be really easy to misread that.

But as long as we're trying to reuse 'def', I think a decorator using
introspection could make this form work:

@CharField
def foo(size=10, nullable=False): "docstring goes here"

Not that I seriously recommend this. :-)

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list