如何创建一个空引用/取消设置引用?

考虑我有一个参考数据集

f = h5py.File("test.h5","a")
d = f.create_dataset("refs",(10,),h5py.ref_dtype)
d[0]
#<HDF5 object reference (null)>

I can create non null references via the .ref attribute of a dataset or group:

d[0] = f.create_dataset("data",data=np.arange(5)).ref
d[0]
# <HDF5 object reference>

现在假设我想将引用设置回null,例如以指示所引用的事物已被删除。

How can I do that or, more generally, is there a direct (non .ref) way of creating a reference?

评论
  • isit
    isit 回复

    找到了!

    Simply assign None.

    d[0]= None
    d[0]
    # <HDF5 object reference (null)>
    

    很明显,真的...

    对不起,噪音。