GHC 2019-02-10

3 comments.

, https://git.io/fhQvp in zmwangx/xdgappdirs
> I agree, but that would make `pathlib2` a hard requirement for python2.

Well, no, I defined a dummy `Path` class which only raises `NotImplementedError` when you actually instantiate anything, and if you don't use `as_path` you never instantiate a `Path`.

> returning `pathlib.Path` by default

Not looking to that right now, I'd like to keep this compatible with `appdirs`.

> enable the issue tracker too.

Sure.

, https://git.io/fhQvh in zmwangx/xdgappdirs
Oh, and since py27 doesn't implement PEP 519, it makes no sense to return a `str` in place of a `Path` anyway. They're hardly interchangeable in any situation.

, https://git.io/fhQvj in zmwangx/xdgappdirs
Thanks, I like pathlib and use it in all my new projects.

I haven't reviewed the code in detail, but at a glance it looks good, except one thing: I don't like silent coercions, especially when a flag is set explicitly to retrieve something else, so I don't think this is a good idea (emphasis mine):

> if "pathlib2" is _not_ installed, then "as_path" **does nothing**.

I'd rather see it fail noisily, so I would do something like this:

```py
if PY3:
	from pathlib import Path
else:
    try:
        from pathlib2 import Path
    except ImportError:
        class Path:
            def __init__(self, *_):
                raise NotImplementedError("pathlib2 not available")
```

and you won't need `PATHLIB_AVAILABLE`.