On Mon, May 23, 2011 at 7:49 PM, Octavian Rasnita <orasn...@gmail.com> wrote:
> That is not an array, but a list. An array has a name and we can't do
> something like the following simple statement in Python:
>
> l = (1, 2)
> d = dict(l)

> An array has a name
What?
In python there is no difference whether your object has any names
mapped to it or not. Its all the same, and object itself does not even
know.
Moreover, (1, 2) is tuple rather than 'array'. If you mean array as
implemented as array, then list is what you want. If you mean array
literally, there is special type 'array' somewhere in stdlib.

As for "can't do":

>>> a = [1,2]
>>> dict([a])
{1: 2}
>>> a = (1,2)
>>> dict([a])
{1: 2}


-- 
With best regards,
Daniel Kluev
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to