(I'm cross-posting this to the PyTables users list so that everyone can
express their opinion.  Please use it when possible.)

Thomas Breuel (el 2007-07-29 a les 05:47:02 +0200) va dir::

> thanks for making pytables available.  We're creating a lot of different
> data files with a lot of different formats and our I/O code looks very
> cluttered.
> 
> I was wondering whether it might be possible to enable the creation of
> groups and arrays in pytable through "natural naming"; that is, something
> like:
> 
> hdf5.root.foo.create("Foo Group") # same as calling createGroup
> hdf5.root.foo.mydata = zeros((200,500)) # same as calling createArray
> hdf5.root.foo.something = hdf5old.root.foo.something # copy something over
> from another table
> 
> etc.

Hi Thomas.  I'd like to point out that natural naming is mainly intended
for node tree *navigation*, specially in interactive mode.  We avoided
on purpose natural naming operations that altered the tree because:

1. It could lead to the accidental removal of nodes.
2. They would mean a *third* way of doing the same things:

   a) file.copyNode(foo, bar)
   b) foo._f_copy(bar)
   c) bar.foo = foo

3. Semantics are less intuitive, i.e. does ``bar.foo = foo`` overwrite
   an existing ``bar.foo``?

Having said that, the ``group.create(something)`` looks to me like a
different proposal: add ``_f_create*()`` methods to the groups which are
equivalent to the ``File.create*()`` ones.  I think this doesn't fit in
the philosophy on node methods either (it would if ``g._f_copy('foo', g2)``
copied a child node, which it doesn't), but I may be wrong.  Any more
opinions on this?    ::

> That would clean up a lot of our I/O code.  If you're concerned whether this
> is safe against typos, it could be an option on opening the file (although I
> don't really see any big problem there).

For programatic use, and specially if you're concerned about the looks
of your code, I'd recommend that you used the methods in the ``File``
class, which can work with full paths and have a more uniform syntax
since the special prefixes used in group methods are not needed.

Hope that helps,

::

        Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
               Cárabos Coop. V.  V  V   Enjoy Data
                                  ""

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to