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

Type converter signature should be changed (or extended) #19

Open
jenisys opened this issue Oct 27, 2013 · 1 comment
Open

Type converter signature should be changed (or extended) #19

jenisys opened this issue Oct 27, 2013 · 1 comment

Comments

@jenisys
Copy link
Contributor

jenisys commented Oct 27, 2013

The type converter function signature should be changed to:

def type_converter(text, match=None, match_start=0):
    # -- NEW: match_start : int = 0, 
    # refers to the first group in the match object for a field where the converter is used.
    pass

This change would allow to provide a generic Parser without type knowledge.
In addition, user-defined types should also provide this signature. Currently, only the first parameter is supported there which prevents to use complexes type converter cases.

Due to backward compatibility reasons, the old user-defined signature should be supported, too, at least for some time.

@moi90
Copy link

moi90 commented Aug 16, 2024

Yes, it would be great if one were able to access the re.Match object to extract individual groups, for example!

@r1chardj0n3s, @wimglenn, do you think this would be feasible? I could be able to provide a PR.

@jenisys: What is the motivation for match_start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants