Re: Style for docstring

2022-04-24 Thread Avi Gross via Python-list
Yes, Michael, a dictionary is an excellent way to represent a closed set of transitions which your permutations are. You examples use numerals but obviously a dictionary will allow transformations  of anything that can be hashed which mostly is items that are not mutable. Of course for the purpose

Re: tail

2022-04-24 Thread dn
On 25/04/2022 04.21, pjfarl...@earthlink.net wrote: >> -Original Message- >> From: dn >> Sent: Saturday, April 23, 2022 6:05 PM >> To: python-list@python.org >> Subject: Re: tail >> > >> NB quite a few of IBM's (extensively researched) algorithms which formed >> utility >> program[me]s

Re: Style for docstring

2022-04-24 Thread dn
On 25/04/2022 01.24, Michael F. Stemper wrote: > On 23/04/2022 12.43, Avi Gross wrote: >> Given what you added, Michael, your function is part of a >> larger collection of functions and being compatible with the others >> is a valid consideration. Whatever you decide, would ideally be done >> consi

Re: tail

2022-04-24 Thread Dennis Lee Bieber
On Sun, 24 Apr 2022 12:21:36 -0400, declaimed the following: > >WRT the mentioned IBM utility program[me]s, the non-Posix part of the IBM >mainframe file system has always provided record-managed storage since the >late 1960's (as opposed to the byte-managed storage of *ix systems) so >searchi

Re: Style for docstring

2022-04-24 Thread Michael F. Stemper
On 24/04/2022 08.24, Michael F. Stemper wrote: On 23/04/2022 12.43, Avi Gross wrote: Given what you added, Michael, your function is part of a larger collection of functions and being compatible with the others is a valid consideration. Whatever you decide, would ideally be done consistently w

Re: Style for docstring

2022-04-24 Thread Michael F. Stemper
On 23/04/2022 12.43, Avi Gross wrote: Given what you added, Michael, your function is part of a larger collection of functions and being compatible with the others is a valid consideration. Whatever you decide, would ideally be done consistently with all or most of them. And, of course, it oth

RE: tail

2022-04-24 Thread pjfarley3
> -Original Message- > From: dn > Sent: Saturday, April 23, 2022 6:05 PM > To: python-list@python.org > Subject: Re: tail > > NB quite a few of IBM's (extensively researched) algorithms which formed > utility > program[me]s on mainframes, made similar such algorithmic choices, in the >

Re: tail

2022-04-24 Thread Marco Sulla
On Sun, 24 Apr 2022 at 11:21, Roel Schroeven wrote: > dn schreef op 24/04/2022 om 0:04: > > Disagreeing with @Chris in the sense that I use tail very frequently, > > and usually in the context of server logs - but I'm talking about the > > Linux implementation, not Python code! > If I understand

Re: tail

2022-04-24 Thread Chris Angelico
On Mon, 25 Apr 2022 at 01:47, Marco Sulla wrote: > > > > On Sat, 23 Apr 2022 at 23:18, Chris Angelico wrote: >> >> Ah. Well, then, THAT is why it's inefficient: you're seeking back one >> single byte at a time, then reading forwards. That is NOT going to >> play nicely with file systems or buffer

Re: tail

2022-04-24 Thread Marco Sulla
On Sun, 24 Apr 2022 at 00:19, Cameron Simpson wrote: > An approach I think you both may have missed: mmap the file and use > mmap.rfind(b'\n') to locate line delimiters. > https://docs.python.org/3/library/mmap.html#mmap.mmap.rfind > Ah, I played very little with mmap, I didn't know about this.

Re: tail

2022-04-24 Thread Marco Sulla
On Sat, 23 Apr 2022 at 23:18, Chris Angelico wrote: > Ah. Well, then, THAT is why it's inefficient: you're seeking back one > single byte at a time, then reading forwards. That is NOT going to > play nicely with file systems or buffers. > > Compare reading line by line over the file with readline

Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Eryk Sun
On 4/23/22, Sunil KR via Python-list wrote: > > I am happy with how the python starts up. When I use python I get > python 2. I am ok with using py -3 for my new scripts, even using the > shebang like #!py -3 `#!py -3` is not a valid shebang for the py launcher. Use `#!python3` to run a script wi

Re: tail

2022-04-24 Thread Avi Gross via Python-list
I have been getting confused by how many interpretations and conditions for chasing tail people seem to be talking about. A fairly normal task is to want to see just the last N lines of a text-based  file.  A variant is the "tail -f" command from UNIX that continues to follow a growing file, ofte

Re: tail

2022-04-24 Thread Chris Angelico
On Sun, 24 Apr 2022 at 21:11, Antoon Pardon wrote: > > > > Op 23/04/2022 om 20:57 schreef Chris Angelico: > > On Sun, 24 Apr 2022 at 04:37, Marco Sulla > > wrote: > >> What about introducing a method for text streams that reads the lines > >> from the bottom? Java has also a ReversedLinesFileRea

Re: tail

2022-04-24 Thread Antoon Pardon
Op 23/04/2022 om 20:57 schreef Chris Angelico: On Sun, 24 Apr 2022 at 04:37, Marco Sulla wrote: What about introducing a method for text streams that reads the lines from the bottom? Java has also a ReversedLinesFileReader with Apache Commons IO. 1) Read the entire file and decode bytes to

Re: tail

2022-04-24 Thread Roel Schroeven
dn schreef op 24/04/2022 om 0:04: Disagreeing with @Chris in the sense that I use tail very frequently, and usually in the context of server logs - but I'm talking about the Linux implementation, not Python code! If I understand Marco correctly, what he want is to read the lines from bottom to t

Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Peter J. Holzer
On 2022-04-24 01:19:38 +, Sunil KR via Python-list wrote: > But the real question/s for me is/are > > -- Why are my strings being sent to python3, so that I get the unicode > related error? You haven't shown us how you invoke those scripts, so we can't answer that question with the informati

Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Sunil KR via Python-list
The question is not one of conversion. The question is this: When I have both python 2 and python3, why is my python 2 script breaking? And when I remove python3 the problem goes away? In both cases (regardless of installing python 3 or not) I am using only python 2 to run the python2 script. W