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-May/126085.html below:

pickling enums created with the functional API

[Python-Dev] PEP 435: pickling enums created with the functional API [Python-Dev] PEP 435: pickling enums created with the functional APIPiotr Duda duda.piotr at gmail.com
Tue May 7 17:35:11 CEST 2013
2013/5/7 Ethan Furman <ethan at stoneleaf.us>:
> On 05/07/2013 08:01 AM, Piotr Duda wrote:
>>
>> 2013/5/7 Ethan Furman <ethan at stoneleaf.us>:
>>>
>>> On 05/07/2013 07:48 AM, Piotr Duda wrote:
>>>>
>>>>
>>>>
>>>> What about adding simple syntax (I proposed this earlier, but no one
>>>> commented) that take care of assigning name and module, something
>>>> like:
>>>>
>>>> def name = expression
>>>>
>>>> which would be rough equivalent for:
>>>>
>>>> name = expression
>>>> name.__name__ = 'name'
>>>> name.__module__ = __name__
>>>
>>>
>>>
>>> How is that different from
>>>
>>> --> name = Enum('module.name', ... )
>>>
>>> ?
>>
>>
>> It's DRY.
>
>
> How?  You need to provide a complete example:
>
> Do you mean something like:
>
> --> def mymodule.Color('red green blue')
>

def Color = Enum('red green blue')

--
闇に隠れた黒い力
弱い心を操る
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