It's common with Parsers as-is to have to do a bunch of ...[0][0] indexing to drill down to the data you want. Adding an option that automatically does ...[0] indexing until a len(l) > 1 list (or a non-list singleton) is obtained would be an attractive way to ease the syntax. Must cope with a final length-zero list...perhaps reduce to None here.
Figure an argument squeeze to capture_body makes sense. Probably not useful on capture_struct. Might also make sense to have squeeze be an argument to Parser initialization, that sets a per-Parser default. capture_body default can be a sentinel, indicating 'defer to Parser setting'.
Figure default should be False, since the squeezing represents a loss of generality/consistency in the output in the event that more or less content is matched than expected.
It's common with
Parsersas-is to have to do a bunch of...[0][0]indexing to drill down to the data you want. Adding an option that automatically does...[0]indexing until alen(l) > 1list (or a non-list singleton) is obtained would be an attractive way to ease the syntax. Must cope with a final length-zero list...perhaps reduce toNonehere.Figure an argument
squeezetocapture_bodymakes sense. Probably not useful oncapture_struct. Might also make sense to havesqueezebe an argument toParserinitialization, that sets a per-Parserdefault.capture_bodydefault can be a sentinel, indicating 'defer toParsersetting'.Figure default should be
False, since the squeezing represents a loss of generality/consistency in the output in the event that more or less content is matched than expected.