From: Norbert N. <Nor...@gm...> - 2004-12-04 10:45:13
|
Hi there, just noticed a behavior that' just contrary to python convention: First the convention in python: ------------ class D: pass d=D() d.asdf="asdf" d.asdf="qwer" # this just overwrites the old attribute del d.asdf del d.asdf # AttributeError: D instance has no attribute 'asdf' ------------ You see: reassignment overwrites the old field, deletion of nonexistant fields gives an exception Now in pytables: ----------------- from tables import * h5file = openFile("dummy.h5",'w') h5file.root.asdf = Group() h5file.root.asdf = Group() # NameError: '/' group already has # a child named 'asdf' in file 'dummy.h5' del h5file.root.asdf del h5file.root.asdf # this just does nothing ----------------- So pytables just behaves in the opposite way from python standards. If this is intentional, it should probably be documented with a good rationale. Otherwise, one should probably fix it and accept the break of compatibility. Ciao, Norbert -- _________________________________________Norbert Nemec Bernhardstr. 2 ... D-93053 Regensburg Tel: 0941 - 2009638 ... Mobil: 0179 - 7475199 eMail: <No...@Ne...> |