ndarray-npy
ndarray-npy copied to clipboard
Match NumPy behavior regarding ".npy" extension for names in .npz files
As @jonathanstrong pointed out in #46, NumPy and ndarray-npy
currently behave differently regarding the names of the arrays in .npz
files. When writing a .npz
file, NumPy unconditionally adds ".npy" to every name. When generating the public list of names when reading a .npz
file, NumPy strips a single ".npy" (if present) from each name. When accessing an array in a .npz
file by name, it first checks if that exact name is in the .npz
file, and if not, it then tries the name with ".npy" appended. While I personally dislike the inconsistency/implicitness of this behavior, ndarray-npy
should consider following it for compatibility with NumPy.