[Tutor] Distinction between tuples and lists
Andre Engels
andreengels at gmail.com
Thu Jan 1 18:33:43 CET 2009
On Thu, Jan 1, 2009 at 3:43 PM, jadrifter <jadrifter at gmail.com> wrote:
> Both data types are indexed and both can contain homogeneous (same as)
> or heterogeneous (different than) data. I get that lists are analogous
> to a C linked lists as tuples are to C structs. I get that the
> flexibility of one and the stability of the other makes them useful in
> different situations. Being able to use struct notation (employee.age
> instead of employee[4]) would be nice but also not that difficult to
> implement as a class either.
The similar construct in Python to this struct notation would be to
use a dictionary rather than a tuple (or list); you could then use
employee['age'] etcetera.
--
André Engels, andreengels at gmail.com
More information about the Tutor
mailing list