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.
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 complex numbers #1331
Support complex numbers #1331
Changes from 11 commits
441188e
a60b6a0
ca12c2b
1e7dbd9
419ec8d
930519e
8529a72
c68a975
c3bc5c7
e589080
90b0946
1ea4bd9
7da4284
7eb84c8
ae774c4
ee119b0
9d373ef
cc53b24
6c8c222
8919589
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a think here about what behaviour we expect in
strict
mode. Probably we only want to acceptcomplex
objects in strict. Do we want to accept integers / floats in "strict" mode? In lax, we can accept everything for sure.Also, similarly the
ValidationMatch::exact
calls should probably be downgraded to eitherstrict
orlax
- these will set the level of priority in e.g.complex | int
union. I think most would agree thatcomplex | int
would expect an integer value to not be cast to a complex. We might want some according tests for some of these union cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict
mode is strict in terms of typing, right? I was mostly thinking from the perspective of mathematics when I addedfloat
andint
. I suppose then we should only allowcomplex
objects in strict mode? ThenValidationMatch::exact
is the same asstrict
. This sounds reasonable to me, but I'm not exactly sure about the how differentexact
andstrict
usually are.One more question about
strict
mode: how does it apply to other input types? Is it like when the input is in JSON, we only accept strings instrict
mode?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, yes (note that in JSON it's less straightforward as you note). In JSON I think we only accept strings in
strict
mode, yes.IIRC in other cases I made subclasses
strict
, ifcomplex
objects allow subclassing. I'd check what I did for ints or floats.