Super Tuples

Donn Cave donn at u.washington.edu
Wed Dec 29 12:39:30 EST 1999


I'm not too worried about the mathematicians, they'll probably be able
to cope with the differences between their tuples and Python's, but
there does seem to be a big gap between the tuple and class instance
as ways to express the equivalent of a C struct.  The tuple is right
for it, it's an efficient and ordered data structure, but the resulting
programming idiom (access by index) is hard to read and prone to error.

What if the compiler could convert names to indices at compile time?
while the runtime could continue to use tuples as it always has, as
the simplest of sequences.  Um,

  st:struct_stat = posix.stat(file)
  size = st.size   # Literally st[6].  Size is not an attribute of st

I have no idea how the compiler would know what :struct_stat means.
Wouldn't have even mentioned it, but for some vague idea that this
general kind of compile time resolution might figure in other plans
for the distant future.

	Donn Cave, University Computing Services, University of Washington
	donn at u.washington.edu



More information about the Python-list mailing list