why not extending the syntax for classes, too ?

Michele Simionato mis6 at pitt.edu
Fri Feb 7 11:10:21 EST 2003


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




More information about the Python-list mailing list