Jean-Michel Pichavant <jeanmic...@sequans.com> wrote: > However, I'm not sure it fixes the main issue: unpacking. Unpacking > prevents you from adding any additional fields to your 'tuple' without > breaking any line of code that was unpacking the tuple (to oppose to > accessing an object attribute).
Generally, if it's a small, known, unlikely-to-change structure, I'd use a tuple. For anything else I'd use a class, namedtuple or bunch. However, pre-namedtuples I'd usually abstract away the field referencing with indices and lambdas: name = 0 role = 1 name_role = lambda t: (t[name], t[role]) name, role = name_role(record) etc -- http://mail.python.org/mailman/listinfo/python-list