Suggestions for python 2
The Blue Wizard
TheBlueWizard at pressroom.com
Thu Jan 20 20:17:53 EST 2000
Guido van Rossum <guido at CNRI.Reston.VA.US> wrote in article
<200001190040.TAA18277 at eric.cnri.reston.va.us>...
> 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/)
Um...out of curiosity, why create a *class* for specific objects (e.g. Sun)
rather than
making instances? But I can see the syntactical niceties here, almost as
if it is a
mix of class and instance stuff. Something to think about.
Cheers,
The Blue Wizard
More information about the Python-list
mailing list