why not extending the syntax for classes, too ?
mwh at python.net
Sat Feb 8 16:40:16 CET 2003
mis6 at pitt.edu (Michele Simionato) writes:
> 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
I'm not sure 'is' gels well with the procedural implementation of the
> Metaclasses are typically denoted by adjectives and thus,
> instead of writing, for instance
> class C(B):
> #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.
Yes, in the thread titled IIRC "no macros in python" from
Your idea has a certain inconsistency: in the def the 'filter'
callable gets the whole function object. In the class statement the
'filter' gets the bits you need to make the class.
It also doesn't chain well, but given your preference of syntax, I
guess you don't care :-)
Enlightenment is probably antithetical to impatience.
-- Erik Naggum, comp.lang.lisp
More information about the Python-list