question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_BaseDiff evaluates to incorrect boolean

See original GitHub issue

Astropy 4.2.1

Consider the following:

>>> h1 = fits.Header()
>>> if fits.HeaderDiff(h1, h1): print('These are the same')
... 
>>> 

Nothing is printed.

The culprit is in _BaseDiff.__bool__: https://github.com/astropy/astropy/blob/e183e398d8bdbbe5c7ccec7a793afed2ecdac4e1/astropy/io/fits/diff.py#L74-L80

Despite the docstring (and other documentation) suggesting that identical objects evaluate to True the return value here is not self.identical.

I tried making a quick fix to this but it broke 19 tests in io.fits so I figured I’d better leave this to the professionals 😃

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
eigenbrotcommented, Jun 2, 2021

Yep! My plan is to work on this and #11770. Hopefully somewhat soon. If someone wants to assign this issue to me I’m fine with it!

1reaction
pllimcommented, May 21, 2021

Maybe the docstring is wrong. I interpret that when bool(diff) is True, there is a difference, and False when there is no difference (i.e., things are the same). @saimn or @embray , what do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What evaluates to True/False in R? - boolean - Stack Overflow
Having 1==TRUE evaluate to TRUE as a special case along with 0 for FALSE is a general rule in many programming languages, not...
Read more >
Conditionals with if/else & Booleans | AP CSP (article)
The condition is a Boolean expression: an expression that evaluates to either true or false . Boolean values are another type of data...
Read more >
true and false operators - treat objects as Boolean values
The false operator returns the bool value true to indicate that its operand is definitely false. The true and false operators aren't guaranteed ......
Read more >
Boolean - JavaScript - MDN Web Docs
The Boolean object represents a truth value: true or false.
Read more >
Boolean Data Type
Logical operators combine boolean values and evaluate to a boolean result. Operator. Name. Example. Result ! Logical. NOT !a true if a is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found