[fitsbits] Output array type when BZERO is an integer {External}

John Parejko parejkoj at uw.edu
Tue Mar 12 19:26:27 EDT 2024


On Mar 12, 2024, at 15:53, Maren Purves via fitsbits <fitsbits at listmgr.nrao.edu> wrote:

> As somebody who 'grew' up' with "IMPLICIT
> NONE" this occasionally still catches me when using python as a
> command line calculator because it doesn't convert to floating point
> in the division of numbers that don't have decimal points.

For the record, that was true in python2, but is not true in python3. In python3, if you want pure integer division, you have to use `//`:

Python 3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:38:07) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 2/3
0.6666666666666666
>>> 2//3
0

John





More information about the fitsbits mailing list