[Python-Dev] Re: PEP 318: "as", barelist

Jewett, Jim J jim.jewett at eds.com
Thu Apr 1 20:37:04 EST 2004


Phillip J. Eby:

> 'as' is not currently a keyword, and making it so would break
> any programs that use it as a name.

It has been documented as a pseudo-keyword for some time, with
the warning that it will may become a real keyword later.

> Really, of the current "before the def" proposals, I think I
> like Samuele's:

	*[classmethod]
	def func(*args):
	     pass

	approach the best.  The '*' seems to say "special note, pay
attention".  :)

I agree that it says special note; it just doesn't say *why* 
the list is special.  We happen to know that it secretly means 

	"After you evaluate this list, keep a reference, then 
	call each member on the function or class I'm about to
	define."

but a keyword (even as) makes it more explicit why this list
is special.  Of course,

	as:  d1, d2, d2
	def func(args):
	   pass

also works; if you put a keyword at the front, then [] becomes
redundant.  And that was one of the bakeoff options, except 
that Guido used "decorate:" instead of "as:" in his example.

-jJ



More information about the Python-Dev mailing list