[Python-ideas] Optional static typing -- the crossroads

Ethan Furman ethan at stoneleaf.us
Fri Aug 15 21:06:55 CEST 2014


On 08/15/2014 11:56 AM, Ryan Hiebert wrote:
>
> Getting an item from a class has no meaning for any classes that I’ve ever used, and I haven’t come up with any hypothetical one that would want to do that.

--> class Foo(Enum):
...    spam = 'meat flavored'
...    eggs = 'chicken by-product'
...
--> Foo
<enum 'Foo'>

--> Foo['spam']
<Foo.spam: 'meat flavored'>

--
~Ethan~


More information about the Python-ideas mailing list