{ } Raw JSON

bundles / astropy 7.0.1 / astropy / io / fits / hdu / hdulist / HDUList / _positive_index_of

function

astropy.io.fits.hdu.hdulist:HDUList._positive_index_of

source: /astropy/io/fits/hdu/hdulist.py :844

Signature

def   _positive_index_of ( self key )

Summary

Same as index_of, but ensures always returning a positive index or zero.

Extended Summary

(Really this should be called non_negative_index_of but it felt too long.)

This means that if the key is a negative integer, we have to convert it to the corresponding positive index. This means knowing the length of the HDUList, which in turn means loading all HDUs. Therefore using negative indices on HDULists is inherently inefficient.

Aliases

  • astropy.io.fits.HDUList._positive_index_of