-
Notifications
You must be signed in to change notification settings - Fork 153
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
OneOf
validator fails when given a set of byte characters
#1070
Comments
I think this is correct https://construct.readthedocs.io/en/latest/advanced.html Byte is a 8bit integer, not a single element byte array. What you are looking for is probably Bytes(1) from construct import *
criteria = OneOf(Bytes(1), {b'h', b'i'})
criteria.parse(b'h') |
🤔 |
Took me a while to get used to as well... but actually it is a beautiful solution, as all arrays (1-N elements) behave similarly, and all scalars do, there is no "Schroedingers" datatype which might be a single element array or a scalar. If that's ok for you would you mind to close the ticket? |
Hello, my apologies for the delay. I was actually hoping to see what the author has to say about it :) |
I am too confused to give you a meaningful response. |
I believe we should get identical behaviour for
b'h'
andord('h')
. I have observed this behaviour when running construct 2.10.68 on python 3.10.12.The text was updated successfully, but these errors were encountered: