New submission from Aaron Gallagher <[EMAIL PROTECTED]>: With the advent of collections.namedtuple, I thought that having a counterpart in the struct module would make having to deal with unpacked data much easier. Per suggestion, this extends the behavior of _struct.Struct rather than a separate NamedStruct class.
The regexp might not be immediately obvious as to what the format required is. The format string is represented like this: "attribute_name1(attribute_format) attribute_name2(attribute_format2)" and so on. Formats given in parentheses without an attribute name are allowed, so that byte order and pad bytes can be specified. For example: "(!) x1(h) x2(h) (2x) y1(h) y2(h)" Suggestions and criticism are welcome. I think it would simplify using the struct module a lot to be able to have named attributes like this. ---------- components: Library (Lib) files: named-struct.patch keywords: patch messages: 67038 nosy: habnabit severity: normal status: open title: struct.Struct.unpack to return a namedtuple for easier attribute access versions: Python 3.0 Added file: http://bugs.python.org/file10368/named-struct.patch __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2909> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com