Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 3:21 AM, Dan Sommers wrote: On 9/30/19 8:40 AM, Barry Scott wrote:  >> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote:  >> On 9/30/19 4:28 AM, Barry Scott wrote:   On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote:   Should pathlib r

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 1:40 AM, Barry Scott wrote: On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 1:09 AM, Chris Angelico wrote: On Mon, Sep 30, 2019 at 9:54 PM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: I would have said the same thing, but the docs⁰ disagree: a PurePath represents the name of (or the path to) a file, but a Path represents the actual file. ⁰ https

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 30/09/19 9:28 PM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. The term "concrete" is applied to Path(), PosixPath(), and WindowsPath() - whereas the others are differen

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 3:56 PM, Barry Scott wrote: On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com > wrote: In the totality of a Path object that claims to represent paths to files, It represents string that *should* in most cases

Re: Delay in python startup.

2019-09-30 Thread Cameron Simpson
On 30Sep2019 10:28, Tobiah wrote: On 9/30/19 9:54 AM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:56 AM Tobiah wrote: It was much faster with -S and instantaneous with -E. I had a directory in my PYTHONPATH that I mount with sshfs from a server. For some reason that mount is very slow.

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > That's an interesting question. If you phrase the question like > that, then you're right: expecting a string to track the content > of a file is a mistake. > > In the totality of a Path object that

Re: Delay in python startup.

2019-09-30 Thread Chris Angelico
On Tue, Oct 1, 2019 at 3:31 AM Tobiah wrote: > > On 9/30/19 9:54 AM, Chris Angelico wrote: > > On Tue, Oct 1, 2019 at 1:56 AM Tobiah wrote: > >> > >> I don't have a lot of information, so here goes a shot in > >> the dark. One day I started experiencing a delay when > >> starting python. I'm on

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 6:13 AM, Dan Sommers wrote: On 9/30/19 12:51 PM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers ... All I'm doing is defending the OP, who was surprised that renaming a file *using a Path instance* didn't reflect that operation *in that Path instance*.  I believe

Re: Delay in python startup.

2019-09-30 Thread Tobiah
On 9/30/19 9:54 AM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:56 AM Tobiah wrote: I don't have a lot of information, so here goes a shot in the dark. One day I started experiencing a delay when starting python. I'm on Ubuntu 16.04. It takes three seconds to get a prompt when I type 'py

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 12:51 PM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: In the totality of a Path object that claims to represent paths to files, including the arguably troublesome read_bytes and write_bytes methods, and a rename method,

Re: Delay in python startup.

2019-09-30 Thread Chris Angelico
On Tue, Oct 1, 2019 at 1:56 AM Tobiah wrote: > > I don't have a lot of information, so here goes a shot in > the dark. One day I started experiencing a delay when > starting python. I'm on Ubuntu 16.04. It takes three > seconds to get a prompt when I type 'python' on the command > line (Python

Re: pathlib

2019-09-30 Thread Chris Angelico
On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: > In the totality of a Path object that claims to represent paths > to files, including the arguably troublesome read_bytes and > write_bytes methods, and a rename method, however, it's not > unreasonable expect

Re: Recursive method in class

2019-09-30 Thread Anders Märak Leffler
What do you mean by transformed? This is probably your understanding already, but a further consequence of when arguments are evaluated plus what you said about data attributes is that the fib(self, n - 1) call will follow the standard LEGB-lookup of whatever "fib" is, from the point of view of the

Re: Hi how do I import files inside a txt file?

2019-09-30 Thread Tobiah
On 9/2/19 3:32 AM, Spencer Du wrote: Hi How do i import files inside a txt file if they exist in the current directory? Once you've read the module names you can use: new_module = __import__(modulename) So you'd read the name from your file into modulename and import the name contained in

Delay in python startup.

2019-09-30 Thread Tobiah
I don't have a lot of information, so here goes a shot in the dark. One day I started experiencing a delay when starting python. I'm on Ubuntu 16.04. It takes three seconds to get a prompt when I type 'python' on the command line (Python 2.7.12). When I run a script that imports packages, it t

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 10:33 AM, Barry Scott wrote: On 30 Sep 2019, at 14:20, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com > wrote: That's the wording I read.  I inferred that "path-handling operations which don't actually access a filesystem" meant an obje

Re: Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Paul Moore
On Mon, 30 Sep 2019 at 15:51, Barry Scott wrote: > > > On 30 Sep 2019, at 14:17, Paul Moore wrote: > > > > How does this compare to the existing appdirs module on PyPI? > > > > I did not know about appdirs. Fair enough ;-) > It does not seem to have separate read vs. save paths. > Required for

Re: Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 14:17, Paul Moore wrote: > > How does this compare to the existing appdirs module on PyPI? > I did not know about appdirs. It does not seem to have separate read vs. save paths. Required for XDG specification where a path of config folder is defined. On 1st run the con

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 14:20, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > That's the wording I read. I inferred that "path-handling operations > which don't actually access a filesystem" meant an object that didn't > necessarily represent an actual file, and that "provide meth

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 8:40 AM, Barry Scott wrote: > > >> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >> >> On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to th

Re: Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Paul Moore
How does this compare to the existing appdirs module on PyPI? On Mon, 30 Sep 2019 at 13:15, Barry Scott wrote: > > See https://pypi.org/project/config-path/ for documentation. > > Install using pip: > > python -m pip install config-path > > I write tools that run on macOS, Unix and Window

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > On 9/30/19 4:28 AM, Barry Scott wrote: >>> On 30 Sep 2019, at 05:40, DL Neil via Python-list >>> wrote: >>> Should pathlib reflect changes it has made to the file-system? >> I think it should not. >> A P

Re: Announcing colour-text and colour-print

2019-09-30 Thread Peter Otten
Barry Scott wrote: > See https://pypi.org/project/colour-text/ for documentation > with colourful examples. > > Install using pip: > > python -m pip install colour-text Have you considered to spell that color-text? In programming the guys who can't spell won ;) -- https://mail.python.org/m

Announcing colour-text and colour-print

2019-09-30 Thread Barry Scott
See https://pypi.org/project/colour-text/ for documentation with colourful examples. Install using pip: python -m pip install colour-text Many command line tools now colour there output to make it easier to pick out important details. I want to do the same for my commands that I tend t

Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Barry Scott
See https://pypi.org/project/config-path/ for documentation. Install using pip: python -m pip install config-path I write tools that run on macOS, Unix and Windows systems. Each operating system has its own conventions on where config files should be stored. Following the conventions is

Re: pathlib

2019-09-30 Thread Chris Angelico
On Mon, Sep 30, 2019 at 9:54 PM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: > I would have said the same thing, but the docs⁰ disagree: a > PurePath represents the name of (or the path to) a file, but a > Path represents the actual file. > > > ⁰ https://docs.python.org/3/library/pathli

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. A Path() is the name of a file it is not the file itself. Why should it track changes in the file system f

Re: Synchronous and Asynchronous callbacks

2019-09-30 Thread Eko palypse
Am Montag, 30. September 2019 11:46:43 UTC+2 schrieb Barry Scott: > > On 29 Sep 2019, at 21:41, Eko palypse wrote: > > > > Am Sonntag, 29. September 2019 19:18:32 UTC+2 schrieb Barry Scott: > >>> On 29 Sep 2019, at 14:14, Eko palypse wrote: > >>> > >>> Unfortunately, I can't make all callbacks

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 09:55, Peter Otten <__pete...@web.de> wrote: > > DL Neil via Python-list wrote: > >> Should pathlib reflect changes it has made to the file-system? >> >> >> Sample code, below, shows pathlib identifying a data-file and then >> renaming it. Yet, after the rename operation

Re: Synchronous and Asynchronous callbacks

2019-09-30 Thread Barry Scott
> On 29 Sep 2019, at 21:41, Eko palypse wrote: > > Am Sonntag, 29. September 2019 19:18:32 UTC+2 schrieb Barry Scott: >>> On 29 Sep 2019, at 14:14, Eko palypse wrote: >>> >>> Unfortunately, I can't make all callbacks synchronous or asynchronous >>> because this has negative effects on the a

Re: pathlib

2019-09-30 Thread Peter Otten
DL Neil via Python-list wrote: > Should pathlib reflect changes it has made to the file-system? > > > Sample code, below, shows pathlib identifying a data-file and then > renaming it. Yet, after the rename operation, pathlib doesn't recognise > its own change; whereas the file system does/proves

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 05:40, DL Neil via Python-list > wrote: > > Should pathlib reflect changes it has made to the file-system? I think it should not. A Path() is the name of a file it is not the file itself. Why should it track changes in the file system for the name? Here is code to show

Re: Recursive method in class

2019-09-30 Thread ast
Le 27/09/2019 à 14:26, Jan van den Broek a écrit : On 2019-09-27, ast wrote: Is it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test: def fib(self, n): if n < 2: return n return fib(self, n-2)