From: Ivan V. i B. <iv...@ca...> - 2005-01-16 20:15:25
|
On Sun, Jan 16, 2005 at 06:00:50PM +0100, Norbert Nemec wrote: > Am Sonntag, 16. Januar 2005 16:35 schrieb Ivan Vilata i Balaguer: > > [...] > > Please note I that intentionally left out=20 > > __set{item,attr}__ because this is a greater change. File.create*() > > calls would be changed to direct constructor invocation for leaves and > > groups, a thing which I definetly think Right and perfectly plausible > > (but I might be wrong). >=20 > I don't quite understand: it already is possible to do > mygroup.somename =3D Array(somevalue) > to create an array. Where is the "greater change"? Actually, I never like= d the=20 > File.create*() method to create elements. Oops, you're certain! I bypassed the fact that Group.__setattr__ takes care of putting the object in the tree. Much easier, then! [...] > > Imagine issuing:=20 > > >>> # h5file.root.detector.readout <=3D> > > >>> tbl =3D h5file.root['detector/readout'] >=20 > or > tbl =3D h5file.root['detector']['readout'] >=20 > Anyhow: I don't see much gain here. Just the question whether you do the = '/'=20 > parsing or not. Don't have much of an opinion there. It would simplify specifying a path (even leading to attributes if necessary) and getting the object. However, doing so would make dictionary key completion in some IDEs useless, so maybe it was not a good idea in the end. > > >>> # h5file.root.column['name column'].attrs.temperature <=3D> > > >>> attr =3D h5file.root['column/name column/attrs/temperature'] >=20 > I have no idea what that's supposed to mean... It means that >>> h5file.root.column['name column'].attrs.temperature and >>> h5file.root['column/name column/attrs/temperature'] are equivalent. They both get the 'temperature' attribute from the 'name column' Leaf, in the 'column' group, in the 'root' group. Anyway, I still think that allowing path notation leading down to attributes could be a good idea, not by using a node's __???item__ or __???attr__, but a File.???Item method that might in this way replace File's getNode and ???AttrNode methods. For instance: >>> h5file.setItem('/column/name column/attrs/temperature', 25) --=20 Ivan Vilata i Balaguer >qo< http://www.carabos.com/ C=E1rabos Coop. V. V V Enjoy Data "" |