On Fri, Aug 8, 2014 at 8:27 AM, Paul Moore
I had a use case where I wanted to allow a config file to contain "path: foo" to create a file called foo, and "path: foo/" to create a directory. It was a shortcut for specifying an explicit "directory: true" parameter as well.
Here is my use case: I have a database application that can save a table in a variety of formats based on the supplied file name. For example, save('t.csv', t) saves in CSV text format while save('t', t) saves in the default binary format. In addition, it supports "splayed" format where a table is saved in multiple files across a directory - one file per column. The native database save function chooses this format when file name ends with a slash: save('t/', t). I would like to make the save() function in Python that works like this, but takes pathlib.Path instances instead of str, but in the current version, I cannot supply 't/' as a Path instance.