Re: preferences file
Karsten Hilbert wrote: > On Sat, Jan 26, 2019 at 05:35:26PM -0500, songbird wrote: > >> >> if the system doesn't have home directories but does have >> >> /usr/local you can put things in there (just check to make >> >> sure first that you aren't clobbering someone else's directories >> >> or files :) ). >> > >> > I don't that that's typically writable to for any odd user. >> >> i'm assuming the person can get that changed if desired >> or change it themselves. if not, then it would be a >> rather strange situation IMO, to not have a home directory >> and to also not have some other place to put things. > > On a Linux system the only other place that should, by > default, offer writable disk space is /tmp/ , I guess. > > Or else /media/$USER/a-user-mounted-removable-media/ ugh! i forgot that /usr should be read only for most normal people. i guess /opt could be used instead with config changes going into /var/opt but i don't really like that either. i'd much rather keep all user information under the specific user home directory. >> at the moment i'm assuming that recent Mac's should >> be posix and have a $HOME and allow for $HOME/.local/share >> and $HOME/.config > > Surely they should. :) songbird -- https://mail.python.org/mailman/listinfo/python-list
Re: preferences file
On Sat, Jan 26, 2019 at 05:35:26PM -0500, songbird wrote: > >> if the system doesn't have home directories but does have > >> /usr/local you can put things in there (just check to make > >> sure first that you aren't clobbering someone else's directories > >> or files :) ). > > > > I don't that that's typically writable to for any odd user. > > i'm assuming the person can get that changed if desired > or change it themselves. if not, then it would be a > rather strange situation IMO, to not have a home directory > and to also not have some other place to put things. On a Linux system the only other place that should, by default, offer writable disk space is /tmp/ , I guess. Or else /media/$USER/a-user-mounted-removable-media/ > at the moment i'm assuming that recent Mac's should > be posix and have a $HOME and allow for $HOME/.local/share > and $HOME/.config Surely they should. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list
Re: preferences file
Karsten Hilbert wrote: > On Fri, Jan 25, 2019 at 11:04:51AM -0500, songbird wrote: > >> if the system doesn't have home directories but does have >> /usr/local you can put things in there (just check to make >> sure first that you aren't clobbering someone else's directories >> or files :) ). > > I don't that that's typically writable to for any odd user. i'm assuming the person can get that changed if desired or change it themselves. if not, then it would be a rather strange situation IMO, to not have a home directory and to also not have some other place to put things. that said, i've not looked at an Android, IOS, Mac, or Windows system in a long time and is why i've had to ask here. over the holidays i touched a Mac for the first time in over 30yrs (no i don't get out much :) ) and wished i had more time to look into it more but couldn't. it would have been nice to answer some of my questions by a few minutes of poking around. at the moment i'm assuming that recent Mac's should be posix and have a $HOME and allow for $HOME/.local/share and $HOME/.config songbird -- https://mail.python.org/mailman/listinfo/python-list
Re: More elegant way to avoid this hacky implementation of single line reduce for grouping a collection?
MRAB wrote: > On 2019-01-25 22:58, Travis Griggs wrote: >> >> grouped = reduce( >> lambda accum, each: (accum[0], >> accum[0][str(each)].append(each)), allValues, >> (defaultdict(list), None))[0] >> >> My question, only for the sake of learning python3 fu/enlightenment, is >> there a simpler way to do this with a reduce? I get there’s lots of way >> to do a groupby. The pursuit here is what’s the >> simplest/cleverest/sneakiest way to do it with reduce, especially if the >> quality that gorupfunc (str() in this example) is only called once per >> item is persevered. >> > How about this: > > grouped = lambda iterable, groupfunc: dict(reduce( > lambda accum, each: accum[groupfunc(each)].append(each) or accum, > iterable, > defaultdict(list))) The false-expr or ret-val expression could also be spelt (false-expr, ret-val)[1] I suppose the peephole optimiser could be taught to avoid building the tuple, i. e. def thelambda(accum, each): return (accum[groupfunc(each)].append(each), accum)[1] would be compiled to def thelambda(accum, each): accum[groupfunc(each)].append(each) return accum -- https://mail.python.org/mailman/listinfo/python-list