Skip to content
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

Support explicit init_after constraints so that fields can be initialized in another order than the default #23

Closed
smarie opened this issue Oct 4, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@smarie
Copy link
Owner

smarie commented Oct 4, 2019

The initialization order can be by default the order of appearance in the class. We could also add a init_after=<fields> argument to field() so that a field requiring other fields to be set before validation, converter or default_factory execution could be initialized afterwards. Another option would be to support a special way to declare that one of these three arguments depends on another field.

@smarie smarie added the enhancement New feature or request label Oct 4, 2019
@smarie smarie mentioned this issue Oct 4, 2019
@smarie smarie changed the title Initialization order should take into account dependency constraints Support explicit init_after constraints so that fields can be initialized in another order than the default Oct 17, 2019
@smarie
Copy link
Owner Author

smarie commented Jun 29, 2020

The workaround is to define the fields in the desired order in the class: indeed pyfields preserves this order of appearance (even in old versions of python, yay!)

@smarie smarie closed this as completed Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant