Creating a list/tuple/dictionary

Andrew Wilkinson ajw126NO at
Tue Jan 7 15:26:59 CET 2003


When the Python interpreter comes across a statement such as...

a = [1,2,3]

how does it go about creating that list?

Does it convert the code into something equivalent to
a = []
(although obviously it would call the C functions directly)

or is there a quicker method that it uses, if so is that accessible from
ordinary python code?

The same question applies to tuples and dictionaries, although I'm guess
that the same answer will apply to all of them.

thanks in advance,
Andrew Wilkinson

More information about the Python-list mailing list