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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to