Empty tables are equal to None but are not None???
See original GitHub issueLet the code speak for itself:
>>> from astropy.table import Table
>>> Table() is None
False
>>> Table() == None
True
Why? For me this is unexpected. Is this documented anywhere? Is this a bug?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Empty Database value is not None, but an empty string
I have a table defined in the following manner: db.define_table('songinfo', Field('songtitle'), Field('artist')) When I add an empty entry, or upload a CSV ...
Read more >Joint tables except the empty records (null) - Stack Overflow
I tried but doing so, if the job is null, I cant see any record (no results). Instead I want to see the...
Read more >How to SELECT Records With No NULL Values in MySQL
Use the MySQL engine to only grab records that you desire while excluding those with pesky NULL columns with the IS NOT NULL...
Read more >Null Values - Azure Data Explorer | Microsoft Learn
The logical NOT operator not() yields the value bool(null) if the argument is the null value. Null values and the in operator. The...
Read more >SQL NULL Values - IS NULL and IS NOT NULL - W3Schools
If a field in a table is optional, it is possible to insert a new record or ... A field with a NULL...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmm, let me pipe in as table co-maintainer: I consider it a bug that
Table() == None
evaluates toTrue
.Looking at the cause, I agree with @mcara that it doesn’t make much sense to return
None
inas_array
for an emptyTable
- if the user asked for an array, they should get one! So I think returning an empty array is fine, and I like the suggestion to just remove theif
clause altogether, as things will work out that way. (Also a nice example of “Special cases aren’t special enough to break the rules”, though we should see whether the next one, “Although practicality beats purity”, holds…)@mcara - did you already make the change and want to turn it in a PR? If not, @disha012, if you want to try that, that would be great!
Note that it may be that some
Table
tests will fail - we will then have to look if it is reasonable to change those, or whether that would cause more trouble than it is worth.OK, those tests explicitly were for the code not behaving as documented, so I think it is fine to change them - anyway, just left my very brief review; let’s move further discussion about the changes there.