[Python-Dev] Re: new syntax for wrapping (PEP 318)

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Feb 22 19:24:42 EST 2004


"Jewett, Jim J" <jim.jewett at eds.com>:

> With the current syntax, I think the cost is too high
> for the benefit.  It might help to add a keyword, like
> 
> 	def foo() wrapped_by [sugary, syntax, list]:

Some keyword might help, but I don't like that particular
choice, as it draws too much attention to the mechanism,
which is not the important thing to be thinking about
when reading the code. Consider

  def marmalade(self) wrapped_by [classmethod]:
    ...

That's wrong -- marmalade isn't wrapped by a class
method, it *is* a class method.

I think it ought to be very readable without any keyword,
provided the names of the wrapper functions are chosen
appropriately. Can you honestly say that, as a Python
newbie, if you had come across

  def marmalade(self) [classmethod]:
    ...

you wouldn't have been able to guess the intent, if not
the mechanism being used to achieve it?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list