[Python-Dev] class name spaces inside an outer function
greg.ewing at canterbury.ac.nz
Sun Apr 28 23:16:09 CEST 2013
Guido van Rossum wrote:
> On Saturday, April 27, 2013, Greg Ewing wrote:
> class Planet(Enum):
> MERCURY = (3.303e+23, 2.4397e6)
> VENUS = (4.869e+24, 6.0518e6)
> EARTH = (5.976e+24, 6.37814e6)
> def __init__(self, mass, radius):
> self.mass = mass
> self.radius = radius
> If you want something like this, doyou really have to inherit from Enum?
I suppose not, but the same could be said for cases where
you want to add methods to enums, etc.
More information about the Python-Dev