[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Christopher Barker
On Wed, Dec 15, 2021 at 7:35 PM Finn Mason wrote: > 4. Should this also be added to pathlib? I say definitely, probably in the >> form of class constructors (e.g. Path.user_data()). >> > putting it in pathlib makes a lot of sense, but I wouldn't make them a bunch of Path classmethods -- why thot

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Finn Mason
On Wed, Dec 15, 2021, 8:32 PM Finn Mason wrote: > It would be a good idea to add something like appdirs to the stdlib. Maybe > something like os.path.userdata() (as an example name). I have four > questions: > > 1. What should the functions be called, and module should they go in? I > personally

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Finn Mason
It would be a good idea to add something like appdirs to the stdlib. Maybe something like os.path.userdata() (as an example name). I have four questions: 1. What should the functions be called, and module should they go in? I personally say os.path module, with names such as userdata() for

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Christopher Barker
On Wed, Dec 15, 2021 at 4:29 PM Christopher Barker wrote: > On Wed, Dec 15, 2021 at 2:57 PM Neil Girdhar > wrote: > >> +1 for appdirs. It's a shame that more projects don't yet use it. >> > I agree -- I've wanted something like that for years in the stdlib. wxPython has wx.StandardPaths --

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Neil Girdhar
+1 for appdirs. It's a shame that more projects don't yet use it. On Wednesday, December 15, 2021 at 9:03:07 AM UTC-5 Matt del Valle wrote: > There is appdirs which does precisely what you're looking for: > > https://pypi.org/project/appdirs/ > > That said, it does seem to be a core bit of

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Barry
> On 15 Dec 2021, at 13:45, JGoutin via Python-ideas > wrote: > > Hello, > > The idea is to add 3 functions to get "config", "data" and "cache" > directories that are commonly used to store application files in user home / > system. > > This look very straightforward to get theses

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread JGoutin via Python-ideas
Hello, Thanks for the suggested packages. "platfromdirs" look to be a fork of "appdirs", both seems to support many OS and cases. That look to be good non stdlib solutions. The "xdg" module seem to only support Linux, but provides more dirs on it.

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Paul Moore
https://pypi.org/project/platformdirs/ is intended to cover this sort of requirement. Paul On Wed, 15 Dec 2021 at 13:47, JGoutin via Python-ideas wrote: > > Hello, > > The idea is to add 3 functions to get "config", "data" and "cache" > directories that are commonly used to store application

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Matt del Valle
There is appdirs which does precisely what you're looking for: https://pypi.org/project/appdirs/ That said, it does seem to be a core bit of functionality that would be nice to have in the os and pathlib modules without needing an external dependency. I'm not going to weigh in on the pros/cons

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Evpok Padding
Hi, [xdg](https://pypi.org/project/xdg).xdg_config_home seems to give you the parent of what you need, doesn't it? Cheers, E On Wed, 15 Dec 2021 at 13:47, JGoutin via Python-ideas < python-ideas@python.org> wrote: > Hello, > > The idea is to add 3 functions to get "config", "data" and "cache"

[Python-ideas] Applications user/system directories functions

2021-12-15 Thread JGoutin via Python-ideas
Hello, The idea is to add 3 functions to get "config", "data" and "cache" directories that are commonly used to store application files in user home / system. This look very straightforward to get theses directories path, but in practices it depends on many factors like OS, environnement

[Python-ideas] Re: Runtime-accessible attribute docstrings – take 2

2021-12-15 Thread Stephen J. Turnbull
Christopher Barker writes: > but it is clear that the whole "are annotations only for typing" > question will be made more clear. Can we please stop posting this? AFAICS, the basic principle is absolutely clear. For the foreseeable future: 1. Annotations are NOT "only for typing". 2. Uses

[Python-ideas] Re: List comprehension operators

2021-12-15 Thread Ben Rudiak-Gould
If you didn't know, range objects already support most non-mutating list methods: >>> fakelist = range(1, 101) >>> fakelist[-1] 100 >>> fakelist[-10:] range(91, 101) >>> 50 in fakelist True >>> fakelist.index(50) 49 Range objects are more efficient than lists