-
Notifications
You must be signed in to change notification settings - Fork 10
add bool to NX_CHAR_OR_NUMBER #590
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
Conversation
I am not sure this is correct, since neither |
My reasoning was that currently, there is no way in nexus that a field can accept any kind of data. I would expect that NX_CHAR_OR_NUMBER should be precisely that. |
Technically, we could include booleans also in NX_INT, then they would be contained in NX_NUMBER |
nexusformat/definitions#1246 (comment) introduced I see that it would be nice to be able to define a field can accept any kind of data. However, with the way the types are currently implemented, I don't think it is really possible. I think the best solution would actually be to be able to write unions of types, like type="NX_NUMBER|NX_CHAR" instead of inventing workarounds like The question is, what we do we do for now in pynxtools? Do we go with the literal interpretation of |
We can keep it as it is, I'll close this. It was just for the conversion parameters and a bool flag there, but I can also use NXcollection there. |
@lukaspie Interestingly enough, bool is a subclass of int:
I am thus wondering why I got a warning in the first place, I will check that. |
This is a bit inconsistent:
|
From https://joergdietrich.github.io/python-numpy-bool-types.html:
|
If bool is a subclass of int in Python, I think it's fine if we allow it, |
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.
LGTM, but linting needs to be fixed
18e552d
to
105cd0d
Compare
Nexus states "Any valid character string or NeXus number representation", and thus I think it makes sense to also allow bool here.