Discussion:
[pytables-users] tables.open_file() vs tables.File()
Ken Walker
2018-05-30 21:40:43 UTC
Permalink
I'm curious -- why are there 2 methods to open a File object?
Reading the documentation, I don't see any difference
between tables.open_file() vs tables.File()
Is there a reason to use one over the other? Is one preferred? If so why?
For background, I use PyTables to read HDF5 files created by another
application.
So far, tables.open_file() has worked fine. I'm wondering if there is a
situation when I should use tables.File()

Thanks,
-Ken
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francesc Alted
2018-05-31 10:14:17 UTC
Permalink
Hi Ken,

That's a good question. The answer is that both interfaces provide the
same functionality, so you can use whichever you prefer. There could be
another reason for this duality, but if I remember correctly, the main one
is historical, with open_file() being developed before, and File()
constructor catching up functionality later. For API backward
compatibility reasons the first one is still available.

Hope this helps,
Francesc
Post by Ken Walker
I'm curious -- why are there 2 methods to open a File object?
Reading the documentation, I don't see any difference
between tables.open_file() vs tables.File()
Is there a reason to use one over the other? Is one preferred? If so why?
For background, I use PyTables to read HDF5 files created by another
application.
So far, tables.open_file() has worked fine. I'm wondering if there is a
situation when I should use tables.File()
Thanks,
-Ken
--
You received this message because you are subscribed to the Google Groups
"pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
antonio.valentino
2018-05-31 11:22:48 UTC
Permalink
Hiopen_file also implements some sanity check IMO it shall be preferred in normal use
Cheers Antonio 


Inviato da smartphone Samsung Galaxy.
-------- Messaggio originale --------Da: Francesc Alted <***@gmail.com> Data: 31/05/18 12:14 (GMT+01:00) A: Ken Walker <***@gmail.com> Cc: pytables-users <pytables-***@googlegroups.com> Oggetto: Re: [pytables-users] tables.open_file() vs tables.File()
Hi Ken,
That's a good question.  The answer is that both interfaces provide the same functionality, so you can use whichever you prefer.  There could be another reason for this duality, but if I remember correctly, the main one is historical, with open_file() being developed before, and File() constructor catching up functionality later.  For API backward compatibility reasons the first one is still available.  
Hope this helps,Francesc
On Wed, May 30, 2018 at 11:40 PM, Ken Walker <***@gmail.com> wrote:
I'm curious -- why are there 2 methods to open a File object? Reading the documentation, I don't see any difference between tables.open_file()  vs tables.File()Is there a reason to use one over the other? Is one preferred? If so why?For background, I use PyTables to read HDF5 files created by another application.So far, tables.open_file()  has worked fine. I'm wondering if there is a situation when I should use tables.File()
Thanks,-Ken
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.

To post to this group, send email to pytables-***@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.

To post to this group, send email to pytables-***@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...