A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-November/106159.html below:

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlibRon Adam rrr at ronadam.com
Tue Nov 30 00:38:26 CET 2010
On 11/28/2010 09:03 PM, Ron Adam wrote:

> It does associate additional info to names and creates a nice dictionary to
> reference.
>
>
>  >>> def name_values( FOO: 1,
> BAR: "Hello World!",
> BAZ: dict(a=1, b=2, c=3) ):
> ... return FOO, BAR, BAZ
> ...
>  >>> foo(1,2,3)
> (1, 2, 3)
>  >>> foo.__annotations__
> {'BAR': 'Hello World!', 'FOO': 1, 'BAZ': {'a': 1, 'c': 3, 'b': 2}}

sigh... I havn't been very focused lately. That should have been:

 >>> def named_values(FOO:1, BAR:"Hello World!", BAZ:dict(a=1, b=2, c=3)):
...   return FOO, BAR, BAZ
...
 >>> named_values.__annotations__
{'BAR': 'Hello World!', 'FOO': 1, 'BAZ': {'a': 1, 'c': 3, 'b': 2}}
 >>> named_values(1, 2, 3)
(1, 2, 3)

Cheers,
    Ron

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