|
From: Francesc A. <fa...@ca...> - 2004-12-09 10:10:29
|
A Dissabte 04 Desembre 2004 12:01, Francesc Altet va escriure:
> A Dissabte 04 Desembre 2004 11:44, Norbert Nemec va escriure:
> > 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'
>=20
> 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.
Mmm, I'm afraid that I was a bit out of context when I wrote this. I thought
that we were talking about attributes of nodes, but in fact we are talking
about *childs* of objects, and I do believe that PyTables should offer some
protection against overwriting a node (or even a complete subtree),
specially when used interactively (you don't want to loose lots of data
because a typing mistake, would you?).=20
I think we should regard the object tree more as a multi-level dictionary
rather than an ordinary object with attributes. In that sense, I should
change the NameError above by a KeyError. What do you think?
On another hand, I've changed the RuntimeError raised during overwriting
read-only system atributes to AttributeError.
>=20
> > del h5file.root.asdf
> > del h5file.root.asdf # this just does nothing
>=20
> Ops, this should raise AttributeError of course.
=46or the same reason as stated before, it should raise a KeyError.
=2D-=20
=46rancesc Altet
Who's your data daddy? =A0PyTables
|