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
Empty VLAarray evaluates to False #1071
Comments
Once items are added to the varlist, then it no longer evaluates to false. Albeit, I'm also seeing an error when trying to append to the varlist initially, with the following showing up under ipython:
This is similar to another error I'm seeing, perhaps it may be somehow a side effect of the build environment. After closing the HDF5 file then re-opening and reinitializing the scoped variables, then I can append to the varlist. Once an element is added to the varlist, then the varlist does not evaluate to False: In [13]: varlist_00 = node_if_found("varlist_00", root_node)
In [14]: varlist_00.append("thunk1024")
In [15]: if varlist_00:
...: print("OK")
...: else:
...: print("?")
...:
OK I'll try testing this with a newer release |
The initial behavior is showing up also with a py-tables 3.9.1 build (blosc2-2.2.10.dev0). A reference to a new, empty varlist (VLArray) is being evaluated as not a truthy value |
I'm a new py-tables user. I was using the following code, trying to understand how to use
VLStringAtom
individually or with an IsDescription class. While trying to ensure that the test script might be reentrant somehow, I'd encountered a concern with how an (empty) VLArray seems to be evaluated under a true/false expression.I'd expected that the
varlist_00
value in the following may evaluate to a non-falsey value whenvarlist_00
denotes a VLArrayAfter the initial call to
create_vlarray
I see the following:The object exists, yet there's the following behavior where
varlist_00
is not evaluated quite as expected:If one may borrow a term from Ruby, is it an accurate assumption that
varlist_00
is being evaluated as a falsey value?There's a workaround for this usage case, simply to test for whether
varlist_00
is exactlyNone
.Maybe it's an isolated instance?
using tables 3.8.0, compiled individually on a FreeBSD system
The text was updated successfully, but these errors were encountered: