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

Comments

3 participants
@lordjabez
Contributor

lordjabez commented Jun 22, 2015

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

This comment has been minimized.

Show comment
Hide comment
@msiemens

msiemens Jun 29, 2015

Owner

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

Owner

msiemens commented Jun 29, 2015

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

@lordjabez

This comment has been minimized.

Show comment
Hide comment
@lordjabez

lordjabez Jun 29, 2015

Contributor

Cool. I'll work on it this weekend.

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

Contributor

lordjabez commented Jun 29, 2015

Cool. I'll work on it this weekend.

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

@robintw

This comment has been minimized.

Show comment
Hide comment
@robintw

robintw 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.

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

This comment has been minimized.

Show comment
Hide comment
@lordjabez

lordjabez Aug 14, 2015

Contributor

That'd be up to @msiemens.

Contributor

lordjabez commented Aug 14, 2015

That'd be up to @msiemens.

@msiemens

This comment has been minimized.

Show comment
Hide comment
@msiemens

msiemens Aug 14, 2015

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.

Owner

msiemens commented Aug 14, 2015

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.

@msiemens msiemens closed this Aug 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment