PEP 318: Can't we all just get along?

Doug Holton insert at spam.here
Tue Aug 17 22:21:45 EDT 2004


Michael J. Fromberger wrote:
> In article <20040817181725194-0400 at braeburn.themorgue.org>,
>  Kevin Smith <Kevin.Smith at sas.com> wrote:
> 
>>Bear with me, but I'd like to propose one more syntax that is simple, 
>>easy for newbies to understand,  and nowhere near as powerful as the 
>>current PEP's syntax.  However, it doesn't add incoherent, arbitrary 
>>syntax either.
>>
>>def classmethod foo(x, y, z):
>>    pass
>>
>>That's it.  One "decorator" that is a callable object that takes a 
>>method as it's only argument.  No expressions, lists, tuples, etc.  Just 
>>one callable object.  Ok, if you absolutely must have more than one.
>>
>>def classmethod synchronized foo(x, y, z):
>>    pass
>>
>>Once again, no expressions.  I know that this isn't going to solve 
>>everyone's type-checking, metadata, and function attribute problems, but 
>>let's face it, using this PEP for all of those things just creates ugly 
>>syntax.  There must be more Pythonic ways to do those things in their 
>>own PEPs.
> 
> 
> Kevin,
> 
> +1 for this idea.

I posted the same thing to python-dev (although it took a week for the 
post to appear) and some guy said -infinity or something smart like that.
I think it is simpler to use keywords for classmethod and staticmethod 
at least.  Those are builtin features of python, just like they are 
builtins for java (which has keywords for its builtins like static, 
abstract, interface, etc.).
I propose this *in addition* to whatever decorator syntax we add.  We 
shouldn't consider staticmethod and classmethod as decorators.



More information about the Python-list mailing list