
9 Oct
2012
9 Oct
'12
7:34 a.m.
Nick Coghlan <ncoghlan@...> writes:
One note regarding the extra "str()" calls relative to something like path.py: we get to define the language, so we can get the benefits of implicit conversion without the many downsides by *defining a new conversion method*, such as __fspath__. That may provide an attractive alternative to offering methods that shadow builtin functions:
open(Path(home, ".config", name + ".conf")) open(home.join(".config", name + ".conf")) open(home / ".config" / name + ".conf")
"As easy to use as path.py, without the design compromises imposed by inheriting from str" is a worthwhile goal.
That's a very good idea! Even better if there's a way to make it work as expected with openat support (for example by allowing __fspath__ to return a (dir_fd, filename) tuple).
Regards
Antoine.