Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'squeeze' argument to Parser init, capture_body, to strip any enclosing length-one lists #99

Open
bskinn opened this issue Oct 29, 2019 · 0 comments
Milestone

Comments

@bskinn
Copy link
Owner

bskinn commented Oct 29, 2019

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.

@bskinn bskinn added this to the v0.3 milestone Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant