Flatten a list/tuple and Call a function with tuples

Jeff jeffober at gmail.com
Wed Jul 25 21:16:18 EDT 2007


> For example, if I have
> the below structure:
>
> Big Record
>    Small Record Type A
>    Many Small Record Type B
>    Small Record Type C
>
> It is pretty natural to use lists, although after a while it is
> difficult to figure out the meaning of the fields in the lists. If
> only there were a way to 'attach' names to members of the list.

You could use dictionaries:

big_record = {
  "small_record_a": { ... },
  "many_small_record_b": {
    "sub_record_of_b": { ... },
    "sub_record_of_b2": { ... },
  },
  "small_record_c": { ... },
}




More information about the Python-list mailing list