Re: io.TextIOWrapper.readlines

2020-11-11 Thread Cameron Simpson
On 11Nov2020 21:26, Karen Shaeffer wrote: >import io > >with io.open(filename, ‘r’) as fd: > lines = fd.readlines(hint=1000) > for line in lines: > # do something > > >I was just looking at the io module. io.open(‘file’, ‘r') returns an >io.TextIOWrapper object, which has the io.TextIOW

io.TextIOWrapper.readlines

2020-11-11 Thread Karen Shaeffer via Python-list
Hi folks, import io with io.open(filename, ‘r’) as fd: lines = fd.readlines(hint=1000) for line in lines: # do something I was just looking at the io module. io.open(‘file’, ‘r') returns an io.TextIOWrapper object, which has the io.TextIOWrapper.readlines(hint=-1/) method. >>>

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread Chris Angelico
On Thu, Nov 12, 2020 at 10:44 AM Dan Stromberg wrote: > > > On Wed, Nov 11, 2020 at 10:38 AM Chris Angelico wrote: >> >> On Thu, Nov 12, 2020 at 4:35 AM Dan Stromberg wrote: >> > >> > On Wed, Nov 11, 2020 at 3:00 AM j c wrote: >> > >> > > Hello all, >> > > >> > > I don't know if this suggestion

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread j c
On Wednesday, 11 November 2020 at 12:22:24 UTC+1, Chris Angelico wrote: > On Wed, Nov 11, 2020 at 10:06 PM j c wrote: > > > > Hello all, > > > > I don't know if this suggestion is missing some point, or it's part of > > something already proposed. > > > > In a professional environment, we've

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread Dan Stromberg
On Wed, Nov 11, 2020 at 10:38 AM Chris Angelico wrote: > On Thu, Nov 12, 2020 at 4:35 AM Dan Stromberg wrote: > > > > On Wed, Nov 11, 2020 at 3:00 AM j c wrote: > > > > > Hello all, > > > > > > I don't know if this suggestion is missing some point, or it's part of > > > something already propos

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread Chris Angelico
On Thu, Nov 12, 2020 at 4:35 AM Dan Stromberg wrote: > > On Wed, Nov 11, 2020 at 3:00 AM j c wrote: > > > Hello all, > > > > I don't know if this suggestion is missing some point, or it's part of > > something already proposed before. > > > > In a professional environment, we've came to a point i

Re: Problem with rearanging list with paired letters next to each others

2020-11-11 Thread dn via Python-list
On 12/11/2020 00:45, Bischoop wrote: I see now I overcomplicated it, what is a good idea then? This is a variation on a data-compression technique called RLE=Run-Length Encoding (excepting that in this case there is no need to count the repetitions). Web.Ref: https://stackabuse.com/run-len

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread Dan Stromberg
On Wed, Nov 11, 2020 at 3:00 AM j c wrote: > Hello all, > > I don't know if this suggestion is missing some point, or it's part of > something already proposed before. > > In a professional environment, we've came to a point in which most people > use virtual environments or code environments to

Re: Need help in installing numpy

2020-11-11 Thread MRAB
On 2020-11-10 23:32, adelamsaleh--- via Python-list wrote: Dear Python Community, I am new to python.  I sucessfully installed python 3.9 from python.org on my windows 10 pc. I checked it by typing 'py' in the windows cmd prompt and the system indeed responds with the version number, then the >

Re: Changing strings in files

2020-11-11 Thread Serhiy Storchaka
10.11.20 11:07, Manfred Lotz пише: > Perhaps better. I like to use os.scandir this way > > def scantree(path: str) -> Iterator[os.DirEntry[str]]: > """Recursively yield DirEntry objects (no directories) > for a given directory. > """ > for entry in os.scandir(path): >

Re: Changing strings in files

2020-11-11 Thread Serhiy Storchaka
10.11.20 22:40, Dennis Lee Bieber пише: > Testing for extension in a list of exclusions would be much faster than > scanning the contents of a file, and the few that do get through would have > to be scanned anyway. Then the simplest method should work: read the first 512 bytes and check if

Re: constant folding - why not more

2020-11-11 Thread Serhiy Storchaka
11.11.20 02:46, Skip Montanaro пише: > I can think of two reasons. One, this kind of comparison will almost never > appear in production code (maybe in unit tests?). Unlike the C family of > languages, Python doesn't have a macro processor which would give symbolic > names to numeric constants or s

Need help in installing numpy

2020-11-11 Thread adelamsaleh--- via Python-list
Dear Python Community, I am new to python.  I sucessfully installed python 3.9 from python.org on my windows 10 pc. I checked it by typing 'py' in the windows cmd prompt and the system indeed responds with the version number, then the >>> prompt, and I can run simple programs without any problem

Re: Problem with rearanging list with paired letters next to each others

2020-11-11 Thread Bischoop
On 2020-11-11, MRAB wrote: >> > Points to note in your first code: > > 1. Modifying a list while iterating over it is a bad idea. > > 2. You're modifying the list that you're passing in and also returning > it. That's a bad idea. Either modify it in place or modify and return a > copy. > > 3. T

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread Chris Angelico
On Wed, Nov 11, 2020 at 10:06 PM j c wrote: > > Hello all, > > I don't know if this suggestion is missing some point, or it's part of > something already proposed. > > In a professional environment, we've came to a point in which most people use > virtual environments or conda environments to av

Getting rid of virtual environments with a better dependency system

2020-11-11 Thread j c
Hello all, I don't know if this suggestion is missing some point, or it's part of something already proposed. In a professional environment, we've came to a point in which most people use virtual environments or conda environments to avoid "polluting a global environment". However, I think th

Getting rid of virtual environments with a better dependency system

2020-11-11 Thread j c
Hello all, I don't know if this suggestion is missing some point, or it's part of something already proposed before. In a professional environment, we've came to a point in which most people use virtual environments or code environments to avoid "polluting a global environment". However, I th