Breakdown of approaches to PEP318

John Roth newsgroups at jhrothjr.com
Mon Mar 29 00:23:24 CEST 2004


"Terry Reedy" <tjreedy at udel.edu> wrote in message
news:mailman.17.1080508539.20120.python-list at python.org...
>
> "Sean Ross" <sross at connectmail.carleton.ca> wrote in message
> news:7vD9c.318$1A6.114130 at news20.bellglobal.com...
> > Here's a breakdown of most of the syntax discussed re: PEP318 using an
> > example from python-dev. There are probably several more (I've added
> [10]).
> > The example applies both function decoration and annotation.
>
> Let me add two more based on a proposal I just posted to PyDev.
>
> > # [5] function attribute dictionary
> > def foo(self)[publish_to_web]:
> >         {spark_rule:"DOC:= HEAD BODY FOOT",
> >          url="/cgi-bin/directory/directory"}
> >         "doc string"
> >         body
>
>
> # [5B]
> def f(self)::
>     "doc string"
>     publish_to_web(foo)
>     {spark_rule:"DOC:= HEAD BODY FOOT",
>       url="/cgi-bin/directory/directory"}
>     :
>     body
>
> > # [6]  @function_attribute = ...
> > def foo(self)[publish_to_web]:
> >         @spark_rule="DOC:= HEAD BODY FOOT"
> >         @url="/cgi-bin/directory/directory"
> >         "doc string"
> >         body
>
> # [6B]
> def foo(self)::
>     "doc string"
>     publish_to_web(foo)
>     spark_rule="DOC:= HEAD BODY FOOT"
>     url="/cgi-bin/directory/directory"
>     :
>     body
>
> > # [7] :function_attribute:...
> > def foo(self)[publish_to_web]:
> >         :spark_rule:"DOC:= HEAD BODY FOOT"
> >         :url:"/cgi-bin/directory/directory"
> >         "doc string"
> >         body
>
> #[7B] identical to [6B]
>
> The essential idea is that definition-time code should be strictly
> separated from run-time code with ':'.  If so, no new syntax is
*necessary*
> (though some can be considered).  Assignments in the def-block would be
> interpreted much like in class bodies (which are also executed at def
> time).

Now, that's an interesting thought that I didn't get out of the discussion.

John Roth
>
> Terry J. Reedy
>
>
>
>
>





More information about the Python-list mailing list