Skip to content

Use str Instead of repr for Data Value Serialization #176

@mandli

Description

@mandli

The data_write function in data.py uses repr to serialize data in the data objects currently. While this often produces the same output as str (str depends on repr) it does not always produce what needs to be output and read in by Fortran code. This was found while trying to switch some paths to the newer pathlib library

from pathlib import Path
my_path = Path() / "my_data.txt"

so that repr(my_path) produces

"PosixPath('my_data.txt')"

where as str(my_path) or f"{my_path}" produces

'my_data.txt'

Note that this is the correct behavior of repr and str, we have just been using them incorrectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions