A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-April/125674.html below:

[Python-Dev] class name spaces inside an outer function

[Python-Dev] class name spaces inside an outer functionGreg Ewing 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.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4