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

Eric Snow ericsnowcurrently at gmail.com
Thu Mar 10 19:22:29 CET 2011


This is the first iteration of the idea that doesn't seem confusing.  The
other approaches did not seem intuitive.

-eric

On Thu, Mar 10, 2011 at 5:49 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> On Thu, Mar 10, 2011 at 6:20 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> > On 10 March 2011 01:37, MRAB <python at mrabarnett.plus.com> wrote:
> >>> I don't like the suggestion as written, but I quite like it as a
> >>> superior syntax proposal for PEP 359.
> >>>
> >>> def (builder) name(param_spec):
> >>>     code_block
> >>>
> >> I think what I don't like is that the name is buried in the middle of
> >> the line and not near the start as in the "class" or "def" statement.
> >
> > Syntactically, I have the same concern - when I first read that line I
> > didn't spot "name" at all.
>
> I actually agree it is a major weakness of the syntax. You can play
> games with "from" to rearrange the line. For example:
>
> def name from builder(param_spec):
>  code_block
>
> as sugar for:
>
> name = builder("name", param_spec_obj, code_obj)
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110310/d934c914/attachment.html>


More information about the Python-ideas mailing list