I don't like the second option much. "open" is the only function in pddl_parser.__init__, and it is supposed to be the only public interface of the package within our own code. It would be nice to keep it this way. Also, with that solution you could still not use "parse_pddl_file" because importing pddl_file.py would still trigger the option parsing. (Even if you don't need parse_pddl_file, I think a solution that allows using the other functions but not this one is not ideal.)
I think moving "import options" into pddl_file.open is a reasonable solution. I suggest adding a comment to explain why it is done this way. If you want, you can go one step further and only "import options" if the options are used, i.e., if either of the filename arguments are None/falsy. Then it's also possible to use "open" without the option parser by passing in two filenames.
|