Hi,

I have a script that needs to handle input files of different types 
(uncompressed, gzipped etc.).

My question is regarding how I should handle the different cases.

My first thought was to use a try-catch block and attempt to open it using the 
most common filetype, then if that failed, try the next most common type etc. 
before finally erroring out.

So basically, using exception handling for flow-control.

However, is that considered bad practice, or un-Pythonic?

What other alternative constructs could I also use, and pros and cons?

(I was thinking I could also use python-magic which wraps libmagic, or I can 
just rely on file extensions).

Other thoughts?

Cheers,
Victor
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to