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

Allow for additional arguments in custom test functions #63

Closed
lordjabez opened this issue Jun 22, 2015 · 5 comments
Closed

Allow for additional arguments in custom test functions #63

lordjabez opened this issue Jun 22, 2015 · 5 comments

Comments

@lordjabez
Copy link
Contributor

I'm finding myself using custom test functions a lot, many of which are nearly identical, and writing the same lambda function over and over is getting tedious.

It'd be really handy if one could pass additional arguments to these functions, so that one could do this:

def case_insensitive_match(a, b):
    return a.casefold() == b.casefold()

db.where('value').test(case_insensitive_match, my_val)
db.where('value').test(case_insensitive_match, my_other_val)

If you're keen on having this ability too, I'd be happy to code it up and submit a pull request.

P.S. Just discovered this library, and love it so far!

@msiemens
Copy link
Owner

That sound like a nice addition! I'll gladly accept the pull request if you submit one :)

@lordjabez
Copy link
Contributor Author

Cool. I'll work on it this weekend.

Edit: or I'll do today during a particularly boring teleconference.

@robintw
Copy link

robintw commented Aug 13, 2015

Is it possible to release a new version to PyPI including this change? I'm writing another module that depends on this functionality, and it'd make things a lot easier for my users to be able to just install from PyPI.

@lordjabez
Copy link
Contributor Author

That'd be up to @msiemens.

@msiemens
Copy link
Owner

Hey all, sorry for letting this wait for so long! I've been quite busy lately with university, but I've now released version 2.4 of TinyDB which includes this feature. I'll try to catch up with the other issues next week.

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

3 participants