matcher() builtin, like joiner() and cycler() #90

Open
miracle2k opened this Issue Jan 21, 2012 · 2 comments

2 participants

@miracle2k

Any interest in including something like this:

https://github.com/miracle2k/jinja2utils/blob/master/src/jinja2utils/match.py

I have just written this code a second time, needing it again and not remembering I had already implemented it once.

It seems to fit very well alongside joiner() and cycler(), and presumably is a common usecase.

@mitsuhiko
The Pallets Projects member

Not a bad idea. Though the default should probably be undefined for consistency with the inline if expression.

@miracle2k

Which value specifically do you suggest should default to undefined?

I have implemented the code as-is here:

https://github.com/miracle2k/jinja2/compare/90-matcher

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