On Fri, Mar 27, 2015 at 8:13 PM, Andrew Barnert email@example.com wrote:
So, if you want the equivalent of a C struct, there's no reason to make it an iterable in Python.
Yes, there is: iterable unpacking.
Which is easy to do: just create a class, and create its fields in the __init__ method (or, in some cases, it's acceptable to use class attributes as "default values" for instance attributes).
Boilerplate with lots of repetition, with little added value. For example, in a basic __init__ each attribute name usually occurs three times: as an argument name in the method declaration, and then twice when it's assigned to self. Ruby does much better, for example.