From: Francesc A. <fa...@ca...> - 2004-12-04 11:02:10
|
A Dissabte 04 Desembre 2004 11:44, Norbert Nemec va escriure: > just noticed a behavior that' just contrary to python convention: >=20 > First the convention in python: > ------------ > class D: > pass > d=3DD() > d.asdf=3D"asdf" > d.asdf=3D"qwer" # this just overwrites the old attribute > del d.asdf > del d.asdf # AttributeError: D instance has no attribute 'asdf' > ------------ >=20 > You see: reassignment overwrites the old field, deletion of nonexistant f= ields=20 > gives an exception >=20 > Now in pytables: > ----------------- > from tables import * > h5file =3D openFile("dummy.h5",'w') > h5file.root.asdf =3D Group() > h5file.root.asdf =3D Group() # NameError: '/' group already has=20 > # a child named 'asdf' in file 'dummy.h5' Yes, I wanted to protect somewhat the attributes so that a user has to delete it before being overwritten. But you are probably right in that we PyTables should follow as carefully as possible the python behaviour. > del h5file.root.asdf > del h5file.root.asdf # this just does nothing Ops, this should raise AttributeError of course. Well, I'll try to address to that in next releases Thanks for noting this! =2D-=20 =46rancesc Altet Who's your data daddy? =A0PyTables |