2005/11/21, Alan Gauld <[EMAIL PROTECTED]>:
> > Each dictionary has just one key and the corresponding
> > value.
> >
> > structure = [{'field1': lenght1}, {'field2': lenght2}, ........]
>
> I'd use a tuple rather than a dictionary here:

Of course, this makes a lot of sense.

[cut]

> you can now do
>
> for field_name, displacement in structure:
>      # work with values here
>
> Is that any better?

Yes, it is exactly what I was looking for!

Probably due to the lacking of experience, but each time I code a
datastructure I am never satisfied, and I have the feeling that I'm
not on the right way..

Thanks a lot for your opinion.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to