-
Notifications
You must be signed in to change notification settings - Fork 5
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
Configure predicates through class kwargs #81
Comments
It's a nice idea and this syntax would be very compact if it is possible to do. I guess I have two concerns:
In terms of |
You can basically add every Key-Value-Pair after the base class, as long as the key isn't already used as an argument in the All additional Key-Value-Pairs will be available in You are right, Pydantic uses |
Currently the predicate metaclass constructor is declared as In the context of metaclasses, does this mean that these first four variables have special meaning (although the variable names themselves can change), but then you can add arbitrary things on the end? So, something like: new(meta, class_name, bases, dct, name=None)` That does seem pretty crazy (powerful but also potentially messed up)! I'll have to experiment with this at some point. Anyway, if you think you can make it work, it does sound like a good compact way of specifying the mapping to the predicate name. |
I created a PR. Feel free to play around with it and let me know what you think :-) |
Allow to configure predicates through class kwargs, allowing more elegant and compact code
would be equal to
Of course it would be much nicer to use
name
instead ofpredicate_name
but currently in_PredicateMeta.__new__
name
is already used as an argumentThe text was updated successfully, but these errors were encountered: