why not extending the syntax for classes, too ?

Anton Muhin antonmuhin at sendmail.ru
Sun Feb 9 08:49:22 EST 2003


Michele Simionato wrote:
> Within the proposals of extending the function syntax,
> reported on the python-dev summary recently posted on c.l.p.,
> I like the most the proposal with "is", as for instance in
> 
> def double(x) is staticmethod:
>     return 2*x
> 
> I like the "is" syntax more than the syntax with "as" and the syntax 
> with the square brackets, especially because with "is"  it would be
> natural to extend the notation for classes, using metaclasses as class
> descriptors. Metaclasses are typically denoted by adjectives and thus,
> instead of writing, for instance
> 
> class C(B): 
>     __metaclass__=Traced 
>     #assuming Traced is a metaclass adding tracing capabilities
> 
> one could write
> 
> class C(B) is Traced:
>     #This is much more readable
> 
> I am curious to know if this has already been proposed. Just my $0.02
> on the way of avoiding too many underscores ;-) 
> 
> 
>                                Michele

Just my 0.002$ --- why not 'of': class C(B) of <metaclass> or
def foo(x) of staticmethod (etc.)?

Anton.





More information about the Python-list mailing list