Indirection-free optimized field metadata. #1129
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please consider this patch. It:
verbose_name,help_text, andcustom_dataspecial cases have been removed and are fully covered/supported by this change. Those test cases didn't even need to change, and it's likely advisable to continue to document de-facto standard labels for new users.Noneassociations on every field if you, like me, don't use the aforementioned metadata in every project. As__slots__is not in use, those would be stored in theself.__dict__mapping. (Which is what this patch updates flexibly instead.)custom_dataas a dictionary adds 20 extra characters to every declaration, or more if using the JSON-like dictionary literal with more than two key/value pairs.custom_databeing what it is, a fixed name, use with most widget libraries will continue to require adaption glue. Is the value ofcustom_dataa dictionary, or instance of a custom class? More glue. Arbitrary field metadata allows the application author to adapt MongoEngine to the widget library more easily, through plain declaration of the attributes required by the library. As the author of a web framework that integrates MongoEngine, and a template/widget framework, glue is a concern for me.custom_datawasn't documented.Thank you for your consideration.