[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h5md-user] Mandate Variable-length string datatype

From: Konrad Hinsen
Subject: [h5md-user] Mandate Variable-length string datatype
Date: Thu, 19 Sep 2013 10:39:05 +0200

Peter Colberg writes:

 > I would like to mandate the variable-length string datatype for all
 > string values appearing in the specification. The restriction to
 > variable-length strings simplifies the implementation of H5MD readers
 > in low-level programs greatly, as fixed-length and variable-length
 > string datatypes are not convertible.


 > On the implementation side, h5py needs to be instructed explicitly
 > to use vlen strings. The h5py author at one point was enthusiastic
 > and let h5py write vlen strings by default, but user(s) complained
 > and this sensible default was reverted.

I happen to agree with Andrew on that point. h5py has a very sensible
default: HDF5 datasets are as equivalent as possible to NumPy arrays.
Making exceptions for special cases (such as character arrays) creates
more problems than it solves. For example, how do you handle record
arrays that mix character and numeric data?

As a general rule, I always favor consistency over convenience in
interface specifications. You can easily add a convenience layer on
top of a consistent interface, but the other direction is a pain.

In our case, PyH5MD is the convenience layer, so the problem is solved :-)

Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: research AT khinsen DOT fastmail DOT net
ORCID: http://orcid.org/0000-0003-0330-9428
Twitter: @khinsen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]