[Tutor] List weirdness

W W srilyk at gmail.com
Fri Feb 13 20:12:59 CET 2009


On Fri, Feb 13, 2009 at 11:01 AM, bob gailer <bgailer at gmail.com> wrote:

> Moos Heintzen wrote:
>
>> <snip> I guess I can't reference [0] on an empty list. (I come from a C
>> background.)
>>
> Can you have an empty array in C? If so, it does not have any elements, so
> you can't refer to element 0.


I think the OP was confusing an empty array in C (something like int foo[10]
= {}; ) where memory is allocated, just not "used", to an empty list in
Python.

AFAIK, creating an empty list in python is a lot more similar to creating an
empty vector in C++.

-Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090213/4cb01321/attachment-0001.htm>


More information about the Tutor mailing list