Creating variables from dicts

Aahz aahz at pythoncraft.com
Sun Feb 28 08:22:31 CET 2010


In article <mailman.145.1266968505.4577.python-list at python.org>,
Tim Chase  <python.list at tim.thechases.com> wrote:
>Luis M. González wrote:
>>
>> If you want a list of items, you use tuples or lists. Examples:
>> 
>>     ('a', 'm', 'p') ---> this is a tuple, and it's made with
>> parenthesis ()
>
>Actually, a tuple is made with commas...the parens are just there 
>to clarify the order of operations and make it easier to read :)
>
>   >>> x = 1,2,3
>   >>> x
>   (1, 2, 3)

Almost true:

>>> x = ()
>>> x
()

Parentheses are definitely needed for the empty tuple.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer



More information about the Python-list mailing list