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

Michael Hudson mwh at python.net
Mon Feb 23 05:57:27 EST 2004


Greg Ewing <greg at cosc.canterbury.ac.nz> writes:

> "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?

This is what I've been thinking: there is likely *no* syntax that is
going to make it totally obvious what's going on, so I don't think one
should use this argument against any given syntax.

As Greg says, the '[classmethod]' suggests that there will be
something classmethod-y about marmalade.

Cheers,
mwh

-- 
  If I had wanted your website to make noise I would have licked
  my finger and rubbed it across the monitor.
                           -- signature of "istartedi" on slashdot.org



More information about the Python-Dev mailing list