[Python-Dev] new syntax for wrapping (PEP 318) - Timothy's summary

Jewett, Jim J jim.jewett at eds.com
Fri Feb 27 10:13:38 EST 2004


Delaney, Timothy C (Timothy):
>	a. def foo (bar) [baz]:
>	b. def foo (bar) as baz:
>	c. def [baz] foo (bar):

Note that c. is like Quixote

>	d. def baz foo (bar):
>	e. def foo [baz] (bar):

>	(1b) is the most visually pleasing, but the 
>	lack of syntax means that the decorator doesn't
>	stand out as well as (a). However, it's simple
>	to syntax-colour 'as', so that's close to a non-issue.

>	(1a) seems to be the most understandable, and is
>	quite visually pleasing - the decorator is obviously special,
>	but feels more like it's an explanatory note.

You left out

f. def foo (bar) mod [baz]:
       pass

The current patch is not really using a list, it is
using magic characters "[" and "]".  Given that, it
could as easily use magic characters "mod [" and "]"

Option 1.f. still has all the syntax-coloring advantages 
of 1.a., but makes it more obvious that the "mod [baz]" 
is truly an optional annotation.

("as" is the shortest suggestion for "mod", but
not the only one.  Also suggested are many variations
on "transformed_by", "modified_by", "decorators", 
"providing", "extended_by", etc.)

-jJ



More information about the Python-Dev mailing list