marshallward/f90nml

Namelist `print` fail when containing generic objects

Opened this issue · 0 comments

As discussed in #102, namelists can be silently initialised with arbitrary objects, but operations which use __str__ will fail since there is no valid Fortran representation. Example:

import f90nml
class C(object):
    pass

c = C()
d = {'config_nml': {'x': c}}
nml = f90nml.Namelist(d)    # No error here
print(nml)
# various errors...

Current proposal is to check for valid input at initialization, although this may exacerbate some of the performance issues observed in #99.