I do not think that you can achieve this with help format, or at least I do not know how to do it. The only way I know to do this is to subclass float, for example:
from math import isnan
class myfloat(float):
def __str__(self):
if isnan(self):
return 'Not available'
else:
return super(myfloat, self).__str__()
After that you can get:
>>> a = myfloat('nan')
>>> a
nan
>>> print(a)
Not available
If you want the view to aappear as "Inaccessible" in the interpreter, you need to override it instead __repr__.
replace ? (, , "nan" ).
>>> a = float('nan')
>>> print('This number is ' + ('%0.2f' % a).replace('nan', 'not available'))
This number is not available