constructors for lists and tuples
Daniel Dittmar
daniel.dittmar at sap.com
Tue Dec 11 09:15:10 EST 2001
> what are the constructors for lists and tuples? I wanted to make a
> list of a known size and then populate it.
[...]
> list (size, init=None)
[None] * size
You could do the same for tuples, but as tuples are immutable, that wouldn't
be really useful for your purpose.
> 2) I don't know where to find documentation on this. All the modules
> document the constructors for their extensions, but looking at the
> library reference, I didn't see anything documenting the complete
> behaviour of the builtin list or tuple.
The 'constructors' for builtin types are wired into the syntax, so this is
described in the Language Reference (e.g.
http://www.python.org/doc/current/ref/lists.html for lists).
Daniel
More information about the Python-list
mailing list