-
-
Notifications
You must be signed in to change notification settings - Fork 113
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 safe equality check #727
Comments
This might be somewhat related to #721. I don't want to add custom operators but if there are more use cases for changing how these things work, one could consider replacing them with custom callbacks. That said, I'm not convinced it's a good idea to have comparison operators panic on type mismatches. There are not that many distinct types floating around in the engine and some coercion needs to take place. For instance you would not want an error if you do Custom operator would mean that Jinja2 also needs that, otherwise we end up in the situation where the engines diverge which I want to mostly avoid. However Jinja2 does allow overriding the operator callback functions. |
Would you be open to adding this as a setting to the syntax options? Could be opt-in to make |
I'm not sure what the right course of action is at the moment. |
I was wondering if there is already support for type safe equality.
I think:
IMO it could be a helpful feature to have a variant of
==
(or==
itself, toggled by a setting) behave in a "type-safe" way and throw an error if someone attempts to compare different types.I think this operator could be
is
, or it could be===
. But maybe there are other good ideas.The text was updated successfully, but these errors were encountered: