Suggestions for python 2

Guido van Rossum guido at CNRI.Reston.VA.US
Tue Jan 18 19:40:18 EST 2000


Eddy,

Have you read my (very old) metaclasses article?

It seems to me that where you write

> Body Sun:
>     """The Sun: the star at the heart of the solar system."""
>     type = 'G2 V'
>     magnitude = 4.79
>     aliases = 'Sol',

I would write

class Sun(Body):
    """The Sun: the star at the heart of the solar system."""
    type = 'G2 V'
    magnitude = 4.79
    aliases = 'Sol',

I.e. only the syntax at the top is slightly different, the rest is the
same.  The metaclass is defined in a similar way too; where you define
__call__(*bases, **what), I define __init__(name, bases, what).

There are some details that are different, but in general it seems
that your proposal is of similar power.  Have you considered this?

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list