From: Francesc A. <fa...@py...> - 2009-12-18 10:44:18
|
Hi List, I'm about to merge the links branch into trunk, but suddenly it occurred to me a new idea on how to dereferring soft/external links. Currently, these links work like this: f = tb.openFile('links.h5', 'w') g = f.createGroup('/', 'g') a1 = f.createCArray(g, 'a', tb.Int64Atom(), shape=(10000,)) la = f.createSoftLink('/', 'la', '/g/a') # /la points to /g/a and dereferring la is implemented via the `__call__()` method: a2 = la() # a2 is the 'a' CArray But I think now that perhaps it would be better to implement dereferencing via a property (say `target`): a2 = la.target # a2 is the 'a' CArray That would allow to natural naming to work even through links referring to groups. For example, if lg lg = f.createSoftLink('/', 'lg', '/g') # /lg points to /g then we could do: a3 = f.root.lg.target.a # a3 is the 'a' CArray which I think is consistent with the way that PyTables uses to access nodes. What people think? Cheers, -- Francesc Alted |