cta-observatory / pyhessio

CTA Python wrapper for hessio event format that is used in output of simtel_array. [DEPRECATED see pyeventio instead]
5 stars 14 forks source link

better file open/close functions #38

Closed kosack closed 7 years ago

kosack commented 8 years ago

I would suggest renaming (or adding an alias):

file_open() should be open_file(), to follow naming conventions (start with verb).

There is already close_file(), for example.

Also, it would be good to provide a context manager interface for open_file():

with pyhessio.open_file(filename) as hessiofile:
     # do things

# file is automatically closed

see https://docs.python.org/3/library/contextlib.html

jacquemier commented 8 years ago

-> https://github.com/cta-observatory/pyhessio/pull/39