-
Notifications
You must be signed in to change notification settings - Fork 14
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
Field canonicalization #661
Conversation
|
Codecov Report
@@ Coverage Diff @@
## main #661 +/- ##
==========================================
+ Coverage 84.91% 85.02% +0.11%
==========================================
Files 89 89
Lines 7419 7427 +8
==========================================
+ Hits 6300 6315 +15
+ Misses 1119 1112 -7
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I forgot the exact reason, but IIRC there was a reason why we removed the |
@Roger-luo Its because Python doesn't have casting. so if you make a |
I'm confused, how does casting effect mutability here? |
Take the |
Ah yes, because |
A reference implementation can be found here https://github.com/patrick-kidger/equinox/blob/main/equinox/_module.py#L46 |
hack
the casting by usingobject.__set_attr__
in the__post_init__
which isn't idea. Another option for this would be to overload constructor methods that use arbitrary inputs and dispatch those to the default pydantic constructor after casting to scalar values.create
function forPythonFn
node so that Code gen doesn't need to use hackyobject.__set_attr__
to do variable assignment.